void (*MXUserMX_UnlockRec)(struct MX_MutexRec *lock) = NULL;
Bool (*MXUserMX_TryLockRec)(struct MX_MutexRec *lock) = NULL;
Bool (*MXUserMX_IsLockedByCurThreadRec)(const struct MX_MutexRec *lock) = NULL;
+static void (*MXUserMX_SetInPanic)(void) = NULL;
+static Bool (*MXUserMX_InPanic)(void) = NULL;
/*
* MXUser_SetInPanic --
* Notify the locking system that a panic is occurring.
*
- * This is the "out of the monitor" - userland - implementation. The "in
- * the monitor" implementation lives in mutex.c.
- *
* Results:
- * Set the internal "in a panic" global variable.
+ * Set the "in a panic" state both in userland, and monitor, if applicable.
*
* Side effects:
* None
MXUser_SetInPanic(void)
{
mxInPanic = TRUE;
+ if (MXUserMX_SetInPanic != NULL) {
+ MXUserMX_SetInPanic();
+ }
}
* MXUser_InPanic --
* Is the caller in the midst of a panic?
*
- * This is the "out of the monitor" - userland - implementation. The "in
- * the monitor" implementation lives in mutex.c.
- *
* Results:
* TRUE Yes
* FALSE No
Bool
MXUser_InPanic(void)
{
- return mxInPanic;
+ return mxInPanic || (MXUserMX_InPanic != NULL && MXUserMX_InPanic());
}
void (*theLockFunc)(struct MX_MutexRec *lock),
void (*theUnlockFunc)(struct MX_MutexRec *lock),
Bool (*theTryLockFunc)(struct MX_MutexRec *lock),
- Bool (*theIsLockedFunc)(const struct MX_MutexRec *lock))
+ Bool (*theIsLockedFunc)(const struct MX_MutexRec *lock),
+ void (*theSetInPanicFunc)(void),
+ Bool (*theInPanicFunc)(void))
{
/*
* This function can be called more than once but the second and later
(MXUserMX_LockRec == NULL) &&
(MXUserMX_UnlockRec == NULL) &&
(MXUserMX_TryLockRec == NULL) &&
- (MXUserMX_IsLockedByCurThreadRec == NULL)) {
+ (MXUserMX_IsLockedByCurThreadRec == NULL) &&
+ (MXUserMX_SetInPanic == NULL) &&
+ (MXUserMX_InPanic == NULL)
+ ) {
MXUserMxLockLister = theLockListFunc;
MXUserMxCheckRank = theRankFunc;
MXUserMX_LockRec = theLockFunc;
MXUserMX_UnlockRec = theUnlockFunc;
MXUserMX_TryLockRec = theTryLockFunc;
MXUserMX_IsLockedByCurThreadRec = theIsLockedFunc;
+ MXUserMX_SetInPanic = theSetInPanicFunc;
+ MXUserMX_InPanic = theInPanicFunc;
} else {
ASSERT((MXUserMxLockLister == theLockListFunc) &&
(MXUserMxCheckRank == theRankFunc) &&
(MXUserMX_LockRec == theLockFunc) &&
(MXUserMX_UnlockRec == theUnlockFunc) &&
(MXUserMX_TryLockRec == theTryLockFunc) &&
- (MXUserMX_IsLockedByCurThreadRec == theIsLockedFunc)
+ (MXUserMX_IsLockedByCurThreadRec == theIsLockedFunc) &&
+ (MXUserMX_SetInPanic == theSetInPanicFunc) &&
+ (MXUserMX_InPanic == theInPanicFunc)
);
}
}