public SpinLock(bool enableThreadOwnerTracking)
{
this.isThreadOwnerTrackingEnabled = enableThreadOwnerTracking;
this.threadWhoTookLock = 0;
this.ticket = new TicketType ();
// this.stallTickets = null;
// Spicy Pixel: Interlocked.CompareExchange with reference types
// tries to JIT on old Mono AOT. The only safe place then to
// initialize stallTickets is in the constructor. It doesn't
// make sense to use a lock because the lock object would have
// to be initialized anyway (and that's the point of this class).
//
// The solution chosen is to always initialize stallTickets here.
// This means:
// 1. Slight performance hit because now we do a heap alloc when
// it is not always necessary.
// 2. AOT has to use this constructor. The default one (which we
// can't define on a struct) does not initialize the collection
// and we can't do it in Enter without a working CompareExchange.
this.stallTickets = new ConcurrentOrderedList<int> ();
}