It's pretty obvious how it might be done in C/C++ on Windows. They manage a Windows Event. It's probably declared as asynchronous, auto-reset and anonymous.
__event says what will set the event
__hook defines a handler for the event (the runtime waits for it with WaitForMultipleObjects and calls the handler when it fires)
Because the language is so integrated with OS it's tricky to port, you'll need an event mechanism on Linux. My first port of call would be to take a look at the implementation of Mono.