|
|
|
|
|
by rdtsc
4328 days ago
|
|
> Closing the socket results in a race condition. That is true. To go more in-depth, you'd do shutdown first. But I think you have to be connected for that. > Canceling select or any other multi-fd call is really easy. Create a pipe and add it to your fd set. Any time you want the thread to wake up (e.g. because you need to tell it that you're canceling something) you just write to the pipe. That a good way, agree. But I would still use a select with 2 file descriptors per thread. One fd for the pipe and one for socket itself. Each thread handles its own request and processing as needed without having one global dispatch in the whole application. Pipe is exposed to the outside in case shutdown needs to be triggered (from another thread). |
|