Hi all, I was playing around with the event queue calls (on MacOSX 10.1.5) and have found a strange blocking issue with the waitevent syscall. The second argument to waitevent is a struct timeval, specifying a timeout for the polling action. The syscall is meant to return when an event is ready or the time expires. In some situation(s) waitevent appears to ignore the timeout and block indefinitely. This cannot be reproduced exactly, but can be reproduced by continuously calling waitevent with a timeout of 0 (which should cause it to return immediately if no events are available) - until it locks. This takes a very short amount of time (average of about 30000 calls). Example code is below, and should be run as follows: ./a.out 2> out When the output file stops growing, waitevent has locked (gdb has be used to confirm this). I would like to investigate this further, by debugging the kernel code for the syscall. Does anyone have a link or information regarding compiling the darwin kernel for MacOSX ? I don't have access to a second machine to run darwin exclusively - so this is my only option. Regards, Chris Leishman eventtest.c ----------------------------- #include <sys/ev.h> #include <sys/time.h> #include <sys/syscall.h> #include <unistd.h> #include <stdio.h> // These aren't defined in the system headers (on MacOSX 10.1.5) #define watchevent(a,b) syscall(231,(a),(b)) #define waitevent(a,b) syscall(232,(a),(b)) #define modwatch(a,b) syscall(233,(a),(b)) int main(void) { struct eventreq theCurrentEvent; struct timeval tv; int i = 0; int result; tv.tv_sec = 0; tv.tv_usec = 0; for (;;) { fprintf(stderr, "Calling waitevent: %d\n", i++); result = waitevent(&theCurrentEvent, &tv); fprintf(stderr, " result: %d\n", result); } return 0; } _______________________________________________ darwin-kernel mailing list | darwin-kernel@lists.apple.com Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-kernel Do not post admin requests to the list. They will be ignored.