[Mono-dev] Need help with signal handlers.

Jonathan Pryor jonpryor at vt.edu
Mon Aug 22 07:14:03 EDT 2005


On Sat, 2005-08-20 at 09:13 -0700, Mike Hull wrote:
> So what if I passed the C program that the C# application is embedded in 
> a ManualResetEvent when I want it to initialize the signal handlers?  
> Instead of calling a method on the managed object.  Then the thread that 
> is waiting on that ManualResetEvent queires a "GetSiganl" InternalCall 
> that returns the signal.

That just seems very strange.

You have two threads: one for managed code (C#) and the other for
unmanaged code (your embedded app).  You want the C# thread to block on
an event until signaled by the unmanaged thread.  The C# thread will
then use an internal call to obtain a pointer to an unmanaged signal
handler.

Why? :-)

It makes more sense for the unmanaged thread to do everything (setup,
add signal handlers) than to mix the threads in the fashion described
above.

If you instead want to ensure that the C# code isn't executed until the
signal handlers are in place, then just don't start the C# thread until
the signal handlers are in place. :-)

The KISS principal is your friend.  Follow it.  :-)

 - Jon





More information about the Mono-devel-list mailing list