-
Notifications
You must be signed in to change notification settings - Fork 94
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
Thread Safety Error on ReadHandler #65
Comments
Hi there! So, what you're running into is that evmap does not let you share a single let read_handler = read_handler.clone() above the call to |
After cloning the let write_lock = Arc::new(Mutex::new(write_handler)); And then inside the OK branch, cloning the reference to the lock with Arc will successfully pass into the closure. let write_lock = Arc::clone(&write_lock); After inserting the aforementioned changes, I successfully ran the script. |
Yes, the write handle does not support concurrent operations in evmap, so you'd need to wrap it in a |
I have created a TCP server which adds a random number to evmap and sends all the value for a given test key.
I am facing
std::cell::Cell<()> cannot be shared between threads safely
error if I spawn a thread for each HTTP req.evmap is concurrent data struct so I think we are able to do crud op concurrently using multiple threads.
Below is the exact code.
Please point out if anything wrong I am doing or any change by which I can read/update evmap using threads.
The text was updated successfully, but these errors were encountered: