error handling not thread safe
miniat_error.c does not support thread local storage, thus the interrupt handler mechanism is not thread safe.
Either we could: 1. Use pthread 2. Use C11 thread_local: https://en.wikipedia.org/wiki/Thread-local_storage#C_and_C.2B.2B 3. Go back to return codes... since their are some corner cases in the error handling
Comments (5)
-
reporter -
I don't believe pthread is supported on windows except in cygwin's posix emulation.
An SDL dependency could be added to provide portable threads and useful system development resources.
-
reporter We've needed sdl before... but im more ok with systems have deps on sdl then the core machine itself. Plus, their oddities in the try catch that are difficult to debug, for instance:
This psuedo code:
void *foo = NULL; TRY { foo = malloc(128); THROW(5); } CATCH(5) { if (foo) free(foo); }
The state snapshot by the TRY includes *foo being NULL. So when we longjmp back, we throw away the value of foo from the malloc and orphan the pointer. You cannot change state in the TRY and expect it on an exception handler....
-
reporter I think it's fixed in this commit. Tested on Mac and Linux: https://bitbucket.org/miniat/0x1-miniat/commits/40822243abf37fb0211d7d832fe7977e56057117
-
reporter - changed status to resolved
- Log in to comment
C11 Threading not implemented in glibc