GlobalEmpire / GERT

Globally Engineered Routing Technology - Simple, powerful, flexible
Other
6 stars 8 forks source link

Inconsistent Windows Shutdown #83

Closed TYKUHN2 closed 3 years ago

TYKUHN2 commented 3 years ago

For some reason on some windows machines (see #82) the QueueUserAPC seems ineffective at forcing threads to interrupt and become joinable. Linux also occasionally throws a fit, possibly due to updating, but it is not as bad as this.

Since both platforms have some annoying behavior, one recommended safety-net is a timer that force-kills the threads using pthread cancellation or killing, and windows TerminateThread. Alternatively just detach. Detaching is probably not great because these threads are likely to wait forever and not appropriately release resources as a result.

TYKUHN2 commented 3 years ago

Issue was the use of a Psuedohandle. I had forgotten that GetCurrentThread() handles cannot be shared between threads. Issue is fixed.

Additionally, the inconsistent behavior on Linux was fixed by reevaluating and masking out SIGUSR1.