[Mono-dev] Control-C handler
Jonathan Pryor
jonpryor at vt.edu
Mon Jan 28 20:02:35 EST 2008
On Mon, 2008-01-28 at 17:13 -0500, Jonathan Pryor wrote:
> On Mon, 2008-01-28 at 21:10 +0100, Paolo Molaro wrote:
> > Deregistration is handled incorrectly: if there are two handlers for the
> > same signal it gets disabled at the first uninstall.
This has been fixed.
> > > The only other major change is the addition of a
> > > UnixSignal.WaitAny(UnixSignal[]) method, which allows waiting on more
> > > than one handle (since WaitHandle.WaitAny() can't currently be used with
> > > WaitHandle subclasses like UnixSignal).
> >
> > I suggest using params in the array argument.
>
> I'm not sure this is a good idea, as WaitAny() is overloaded:
>
> static bool WaitAny(params UnixSignal[] signals);
> static bool WaitAny(UnixSignal[] signals, TimeSpan timeout);
> static bool WaitAny(UnixSignal[] signals, int timeout);
>
> Consequently, moving from WaitAny(UnixSignal[]) to one of the other
> overloads would result in inconsistent usage (adding `new
> UnixSignal[]{...}', etc.).
>
> Alternatively, we could alter the ordering so that things are always
> consistent, though this would result in a different order from the
> WaitHandle.WaitAny() methods:
>
> static bool WaitAny(params UnixSignal[] signals);
> static bool WaitAny(TimeSpan timeout, params UnixSignal[] signals);
> static bool WaitAny(int timeout, params UnixSignal[] signals);
>
> Consequently, I'm conflicted: we either keep things as they are,
> allowing consistency with WaitHandle.WaitAny() and making it easy to
> change the overload used, or provide params everywhere, and differ from
> WaitHandle.
Still not sure about this; would appreciate some additional feedback
before making this change.
> > An extensive test program that shows this stuff works before being
> > committed would also help.
Attached. I should probably migrate it to NUnit and add it to the
Mono.Posix tests code...
So the only remaining question, to me, is the type and ordering of the
UnixSignal.WaitAny() methods (i.e. the 'params' question).
Thanks,
- Jon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: support-v5.diff
Type: text/x-patch
Size: 6699 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080128/b91a5975/attachment.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mono.Posix-v5.diff
Type: text/x-patch
Size: 8439 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080128/b91a5975/attachment-0001.bin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: us-test.cs
Type: text/x-csharp
Size: 3017 bytes
Desc: not available
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080128/b91a5975/attachment-0002.bin
More information about the Mono-devel-list
mailing list