Issues with Socket.accept() and SIGUSR1

Nemanja Boric 4burgos at gmail.com
Fri Dec 8 23:24:42 UTC 2017


On Friday, 8 December 2017 at 23:11:47 UTC, Adam D. Ruppe wrote:
> On Friday, 8 December 2017 at 22:27:41 UTC, LeqxLeqx wrote:
>> Normally the accept will throw a timeout and then the loop 
>> will continue to listen, but sometimes (and I can't find a 
>> decent pattern) the Socket.accept() method will raise a 
>> SIGUSR1 rather than throwing an exception of any kind.
>
> That probably means the *other* thread started a garbage 
> collection cycle. The D GC uses that signal to pause threads 
> while it scans memory, so they don't change out from under it 
> mid-scan.
>
> All you need to do is try the accept again if that happens. It 
> isn't really an exception, it is just an EINTR - signal call 
> interrupted - and you are supposed to just try again when that 
> happens (unless the interruption meant the program is now 
> instructed to terminate e.g. SIGINT)

Sorry, I've completely missed your first paragraph! It's after 
midnight here, good night!


More information about the Digitalmars-d mailing list