-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Why does handler
need to be Sync
?
#205
Comments
I actually ran into this exact case today! Rouille uses a thread pool internally, which means that multiple requests could be happening simultaneously. That concurrent access means that any types you access from your handler need to be |
Hi, I ran into this issue too. The problem, from what I can tell, is that there is no way to actually clone a Often in cases like these, you can get around it by cloning then moving in an extra block:
But even this doesn't appear to work. There should be a way to share The |
I have a situation where I want to pass a sender to the request handler:
Unfortunately, this doesn't work because unlike
std::thread::spawn
,start_server(addr, handler)
requires thathandler
isSync
.Why is this the case? Is there any way to get around it without resorting to a
Mutex
?The text was updated successfully, but these errors were encountered: