Closed Berrysoft closed 1 year ago
/cc @bdbai
Without incurring runtime cost, I think we can mark all Sockets/FDs !Send
. Users may manually detach an object, obtaining a Send
, type-stamped wrapper to send to another thread. To get back the original wrapped object, users will have to call attach on the wrapper. Does it make sense?
Well, although the driver attached is thread local, the handle itself is technically thread safe...
I've also decided to not use undocumented APIs, which means I cannot detach a handle from the driver. A little painful.
Currently the file handles are attached immediately after created. That makes it impossible to write a multi-threading web server: listen in one thread, and spawn the accepted socket to other threads. The solution is: