diff options
author | Andi McClure <andi.mcclure@xamarin.com> | 2015-12-02 22:58:55 +0300 |
---|---|---|
committer | Andi McClure <andi.mcclure@xamarin.com> | 2015-12-02 22:58:55 +0300 |
commit | bca3964c8bb21bc5d991b6720b44a074c5590e24 (patch) | |
tree | ae182aa380daa21a429d7ba18497dd0e293eaff6 /mcs/class/Mono.Posix | |
parent | d94ba5bb3052854a389076f13822fe7e7fc2e605 (diff) |
Cleanup in signal.c and related tests
Add comments, add assert for edge case around signal registration, and
make consistent *always* using atomic get/set for memory shared
between the signal handler and the threads.
Diffstat (limited to 'mcs/class/Mono.Posix')
-rw-r--r-- | mcs/class/Mono.Posix/Mono.Unix/UnixSignal.cs | 2 | ||||
-rw-r--r-- | mcs/class/Mono.Posix/Test/Mono.Unix/UnixSignalTest.cs | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/mcs/class/Mono.Posix/Mono.Unix/UnixSignal.cs b/mcs/class/Mono.Posix/Mono.Unix/UnixSignal.cs index b71743f9102..6c441e528eb 100644 --- a/mcs/class/Mono.Posix/Mono.Unix/UnixSignal.cs +++ b/mcs/class/Mono.Posix/Mono.Unix/UnixSignal.cs @@ -145,6 +145,8 @@ namespace Mono.Unix { set {Interlocked.Exchange (ref Info->count, value);} } + // signum, count, write_fd, pipecnt, and pipelock are read from a signal handler thread + // count and pipelock are both read and written from the signal handler thread [Map] struct SignalInfo { public int signum, count, read_fd, write_fd, pipecnt, pipelock, have_handler; diff --git a/mcs/class/Mono.Posix/Test/Mono.Unix/UnixSignalTest.cs b/mcs/class/Mono.Posix/Test/Mono.Unix/UnixSignalTest.cs index 14613104d9b..d621ad51d45 100644 --- a/mcs/class/Mono.Posix/Test/Mono.Unix/UnixSignalTest.cs +++ b/mcs/class/Mono.Posix/Test/Mono.Unix/UnixSignalTest.cs @@ -456,6 +456,7 @@ namespace MonoTests.Mono.Unix { s.Close (); } + // Create thread that issues many signals from a set of harmless signals static Thread CreateRaiseStormThread (int max) { return new Thread (delegate () { @@ -486,6 +487,7 @@ namespace MonoTests.Mono.Unix { CloseSignals (usignals); } + // Create thread that repeatedly registers then unregisters signal handlers static Thread CreateSignalCreatorThread () { return new Thread (delegate () { @@ -523,6 +525,7 @@ namespace MonoTests.Mono.Unix { CloseSignals (usignals); } + // Create thread that blocks until at least one of the given signals is received static Thread CreateWaitAnyThread (params UnixSignal[] usignals) { return new Thread (delegate () { |