Introduce a new kind of mutex, the suspension safe one.
* mono-mutex.c: Add mono_mutex_init_suspend_safe so special targets
like OSX that have broken implementations of suspend for pthread mutex
will hang less.
A suspension safe mutex means one that can handle this scenario:
mutex M
thread 1:
1)lock M
2)suspend thread 2
3)unlock M
4)lock M
thread 2:
5)lock M
Say (1) happens before (5) and (5) happens before (2).
This means that thread 2 was suspended by the kernel because
it's waiting on mutext M.
Thread 1 then proceed to suspend thread 2 and unlock/lock the
mutex.
If the kernel implements mutexes with FIFO wait lists, this means
that thread 1 will be blocked waiting for thread 2 acquire the lock.
Since thread 2 is suspended, we have a deadlock.
A suspend safe mutex is an unfair lock but will schedule any runable
thread that is waiting for a the lock.
This problem was witnessed on OSX in mono/tests/thread-exit.cs.