[racket] sync on OS semaphore on Unix

From: Berthold Baeuml (berthold.baeuml at dlr.de)
Date: Mon Feb 6 18:11:51 EST 2012

Is there a "canonical" way to make a native OS semaphore (Unix), set from an OS thread, into a racket syncable event? The use case I have in mind is a racket program which starts a native OS thread for realtime execution of a C loop. This OS thread sets a OS semaphore to signal that some data is ready for being taken by the racket side. A racket thread should now be able to somehow sync on this OS semaphore. Important fact is that the OS thread has to fulfill (hard) realtime constraints and, hence, is not allowed to call any scheme_... functions of the racket C-API with non-deterministic  execution time. Moreover, I do not want to have an additional OS thread (with non-realtime constraints, then) for translating the event to the racket side, because this will give a lot of "thread clutter, e.g. in with the ps command". A perfect solution would be to do it completely with the ffi-module and not having to fall back to the racket C-API. 

All the best,

Posted on the users mailing list.