]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
lib/thread and lib/lock: cleanup the cooperation
authorVMware, Inc <>
Thu, 17 Jun 2010 21:37:51 +0000 (14:37 -0700)
committerMarcelo Vanzin <mvanzin@vmware.com>
Thu, 17 Jun 2010 21:37:51 +0000 (14:37 -0700)
The watchdog routine needs to be used by both MX and MXUser
however planting the callback in only done in userland - move
ownership of the callback (and planting it) to MXUser.

Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/lib/include/userlock.h
open-vm-tools/lib/lock/ul.c
open-vm-tools/lib/lock/ulInt.h
open-vm-tools/lib/lock/ulIntShared.h

index 04901c82466cb0c015794ae945d8e501c043a7f3..cd6571781ee8108dbe4da9682d434020a469a5b4 100644 (file)
@@ -149,6 +149,8 @@ void MXUser_DestroyCondVar(MXUserCondVar *condVar);
 
 struct MX_MutexRec;
 
+void MXUser_PlantThreadWatchDog(void (*func)(void));
+
 #if defined(VMX86_VMX)
 MXUserRecLock *MXUser_InitFromMXRec(const char *name,
                                     struct MX_MutexRec *mutex,
index e7cece7360b5b6b93909380be52b097ec37a8509..d4a57f36089981cf47b0645eae5defc73640cc37 100644 (file)
 #include "util.h"
 #include "userlock.h"
 #include "ulInt.h"
-#include "ulIntShared.h"
 #include "hashTable.h"
 
 
 static Bool mxInPanic = FALSE;  // track when involved in a panic
 
+void (*MXUserVThreadWatchDog)(void);
+
 Bool (*MXUserTryAcquireForceFail)() = NULL;
 
 static MX_Rank (*MXUserMxCheckRank)(void) = NULL;
@@ -643,3 +644,28 @@ MXUserListLocks(void)
    }
 #endif
 }
+
+
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * MXUser_PlantThreadWatchDog --
+ *
+ *      Plant the pointer to VThread_WatchDog.
+ *
+ *      If this is called lib/thread is around.
+ *
+ * Results:
+ *      None
+ *
+ * Side effects:
+ *      None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+void
+MXUser_PlantThreadWatchDog(void (*func)(void))
+{
+   MXUserVThreadWatchDog = func;
+}
index bba7d9a775e52307c95e69c5c34eea8c6b5cf06c..37ca5f2cdae623a768d698372f6d8f731b65b0a3 100644 (file)
@@ -39,6 +39,7 @@ typedef pthread_t MXThreadID;
 #include "vm_basic_types.h"
 #include "vthreadBase.h"
 #include "hostinfo.h"
+#include "ulIntShared.h"
 
 #if defined(MXUSER_STATS)
 #include "circList.h"
index 9e2d439c41757fe281423d5a6113530543c269b8..1feae6a5452b34bb9ef4f2e647f9a901b869ff5c 100644 (file)
 #ifndef _ULINTSHARED_H_
 #define _ULINTSHARED_H_
 
+extern void (*MXUserVThreadWatchDog)(void);
+
 extern void MXUserListLocks(void);
 
+extern void MXUserPerThreadData(VThreadID, uint64 *, uint64 *);
+
 extern void MXUserInstallMxHooks(void (*theLockListFunc)(void),
                                  MX_Rank (*theRankFunc)(void),
                                  void (*theLockFunc)(struct MX_MutexRec *lock),