5 ms·
> probably easier than using whatever async/await interface your language has Is it? I haven't used threads directly in a while, but I remember dealing with si
by pmoleri 6y ago
> probably easier than using whatever async/await interface your language has
Is it? I haven't used threads directly in a while, but I remember dealing with sinchronization issues. Problems that just don't exist in single threaded node with async await.
I find the async Promise or Task to be a more useful abstraction than the thread. Although, you need threads or a task dispatcher with a pool of threads if you need to run cpu intensive stuff.
- throwaway894345 6y agoIf you’re just handling requests there isn’t much for shared state, so you don’t have to worry about synchronization.
- pdonis 6y ago> If you’re just handling requests there isn’t much for shared state No, but if your single listener/server thread is managing epoll for all your file descriptors, you do have to have a way of synchronizing the worker threads with it, so they know when and when not to read from/write to their fd's. I assume Rachel is using some kind of semaphore or other threading synchronization mechanism for this.
- throwaway894345 6y agoRight, there is some shared state, but it’s very minimal.