-
|
I am currently having some issues that I don't fully understand yet but I think it is because I am trying to share one lock (RwLock) between zio instances where each zio instance is on its own thread. So the question is, can I even actually do that? Can I share a lock between instances of Zio on different threads? If yes, are there any rules to it? If no, what are the the alternatives? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
There is nothing fundamental in the code that would make it incompatible with cross-thread communication. All these sync primitives boil down to some internal logic and then either parking the current task/thread, or resuming the parked task/thread. All of those operations are safe across runtimes, or even foreign threads. But there could he a specific bug in RwLock. I'll be honest I'm not super happy with the current RwLock in zio, it does thundering herd issues, which are technically okay, just inefficient. |
Beta Was this translation helpful? Give feedback.
There is nothing fundamental in the code that would make it incompatible with cross-thread communication.
All these sync primitives boil down to some internal logic and then either parking the current task/thread, or resuming the parked task/thread. All of those operations are safe across runtimes, or even foreign threads.
But there could he a specific bug in RwLock. I'll be honest I'm not super happy with the current RwLock in zio, it does thundering herd issues, which are technically okay, just inefficient.