Oh man... how silly, I know what's going on. We are using processes not threads, so although we are sharing the same array of handlers, they are registered for different processes. When the array is full the next processes fail to register handlers _for_them_ so as andrey rightly said, the default action (death) is taken when the alarm note is sent.
The solution is obvious, cancel the process' handlers before it exits so we don't run out of space. Now, is there any reason to not do that in threadexits() when it terminates the process? Shouldn't threadnotify() cancel only the process' handlers? We are sharing onnote[NFN] and the code as it is right now removes the first handler that match the pointer, it can belong to another process. Something like this?: int threadnotify(int (*f)(void*, char*), int in) { int i, topid; int (*from)(void*, char*), (*to)(void*, char*); if(in){ from = nil; frompid = 0; to = f; topid = _threadgetproc()->pid; }else{ from = f; frompid = _threadgetproc()->pid; to = nil; topid = 0; } lock(&onnotelock); for(i=0; i<NFN; i++) if(onnote[i]==from && onnotepid[i]==frompid){ onnote[i] = to; onnotepid[i] = topid; break; } unlock(&onnotelock); return i<NFN; } Any thoughts? adr. ------------------------------------------ 9fans: 9fans Permalink: https://9fans.topicbox.com/groups/9fans/Tfa6823048ad90a21-M45b18058b8188bfcc376c11c Delivery options: https://9fans.topicbox.com/groups/9fans/subscription