Index: trunk/src/user32/new/gen_object.cpp
===================================================================
--- trunk/src/user32/new/gen_object.cpp	(revision 653)
+++ trunk/src/user32/new/gen_object.cpp	(revision 655)
@@ -1,3 +1,3 @@
-/* $Id: gen_object.cpp,v 1.2 1999-07-15 12:01:31 sandervl Exp $ */
+/* $Id: gen_object.cpp,v 1.3 1999-08-24 09:20:30 sandervl Exp $ */
 /*
  * Generic Object Class for OS/2
@@ -13,6 +13,7 @@
 #include <gen_object.h>
 #include <misc.h>
+#include <vmutex.h>
 
-HMTX genMutexSem = 0;
+VMutex genMutex[OBJTYPE_MAX];
 
 //******************************************************************************
@@ -20,24 +21,9 @@
 GenericObject::GenericObject(GenericObject **head, DWORD objType)
 {
- APIRET rc;
-
   this->objType = objType;
   this->head    = head;
   this->next    = NULL;
 
-  if(genMutexSem == 0) {
-	rc = DosCreateMutexSem(NULL, &genMutexSem, 0, FALSE);
-	if(rc) {
-		dprintf(("GenericObject ctor: DosCreateMutexSem returned %d", rc));
-		DebugInt3();
-		exit(1);
-	}
-  }
-  //insert in linked list
-  rc = DosRequestMutexSem(genMutexSem, SEM_INDEFINITE_WAIT);
-  if(rc) {
-	dprintf(("GenericObject ctor: DosRequestMutexSem returned %d", rc));
-	DebugInt3();
-  }
+  genMutex[objType].enter();
   if(*head == NULL) {
 	*head = this;	
@@ -51,5 +37,5 @@
 	cur->next = this;
   }
-  DosReleaseMutexSem(genMutexSem);
+  genMutex[objType].leave();
 }
 //******************************************************************************
@@ -57,12 +43,6 @@
 GenericObject::~GenericObject()
 {
- APIRET rc;
-
   //remove from linked list
-  rc = DosRequestMutexSem(genMutexSem, SEM_INDEFINITE_WAIT);
-  if(rc) {
-	dprintf(("GenericObject dtor: DosRequestMutexSem returned %d", rc));
-	DebugInt3();
-  }
+  genMutex[objType].enter();
   if(*head == this) {
 	*head = next;	
@@ -80,6 +60,30 @@
 	cur->next = next;
   }
-  DosReleaseMutexSem(genMutexSem);
+  genMutex[objType].leave();
 }
 //******************************************************************************
 //******************************************************************************
+void GenericObject::enterMutex()
+{
+  genMutex[objType].enter();
+}
+//******************************************************************************
+//******************************************************************************
+void GenericObject::leaveMutex()
+{
+  genMutex[objType].leave();
+}
+//******************************************************************************
+//******************************************************************************
+void GenericObject::enterMutex(DWORD objType)
+{
+  genMutex[objType].enter();
+}
+//******************************************************************************
+//******************************************************************************
+void GenericObject::leaveMutex(DWORD objType)
+{
+  genMutex[objType].leave();
+}
+//******************************************************************************
+//******************************************************************************
Index: trunk/src/user32/new/gen_object.h
===================================================================
--- trunk/src/user32/new/gen_object.h	(revision 653)
+++ trunk/src/user32/new/gen_object.h	(revision 655)
@@ -1,3 +1,3 @@
-/* $Id: gen_object.h,v 1.1 1999-07-14 08:35:34 sandervl Exp $ */
+/* $Id: gen_object.h,v 1.2 1999-08-24 09:20:30 sandervl Exp $ */
 /*
  * Generic Object Class for OS/2
@@ -16,4 +16,6 @@
 #define OBJTYPE_CURSOR		5
 #define OBJTYPE_MENU		6
+
+#define OBJTYPE_MAX             7
 //......
 
@@ -30,5 +32,10 @@
 GenericObject *GetNext()	{ return next;  };
 
-	 
+	 void  enterMutex();
+	 void  leaveMutex();
+
+static	 void  enterMutex(DWORD objType);
+static	 void  leaveMutex(DWORD objType);
+
 private:
 
Index: trunk/src/user32/new/win32class.cpp
===================================================================
--- trunk/src/user32/new/win32class.cpp	(revision 653)
+++ trunk/src/user32/new/win32class.cpp	(revision 655)
@@ -1,3 +1,3 @@
-/* $Id: win32class.cpp,v 1.6 1999-08-21 12:53:28 sandervl Exp $ */
+/* $Id: win32class.cpp,v 1.7 1999-08-24 09:20:30 sandervl Exp $ */
 /*
  * Win32 Window Class Managment Code for OS/2
@@ -120,11 +120,17 @@
 Win32WndClass *Win32WndClass::FindClass(HINSTANCE hInstance, LPSTR id)
 {
+  enterMutex(OBJTYPE_CLASS);
+
   Win32WndClass *wndclass = (Win32WndClass *)wndclasses;
 
-  if(wndclass == NULL)  return(NULL);
+  if(wndclass == NULL) {
+	leaveMutex(OBJTYPE_CLASS);
+	return(NULL);
+  }
 
   if(HIWORD(id) != 0) {
 //CB: read comment below!
         if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) {
+		leaveMutex(OBJTYPE_CLASS);
                 return(wndclass);
         }
@@ -133,4 +139,5 @@
                 while(wndclass != NULL) {
                         if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) {
+				leaveMutex(OBJTYPE_CLASS);
                                 return(wndclass);
                         }
@@ -143,4 +150,5 @@
 //CB: need more code to compare instance; convert 0 to exe module handle
         if(wndclass->classAtom == (DWORD)id /*&& wndclass->hInstance == hInstance*/) {
+		leaveMutex(OBJTYPE_CLASS);
                 return(wndclass);
         }
@@ -149,5 +157,6 @@
                 while(wndclass != NULL) {
                         if(wndclass->classAtom == (DWORD)id/* && wndclass->hInstance == hInstance*/) {
-                                return(wndclass);
+				leaveMutex(OBJTYPE_CLASS);
+	        	        return(wndclass);
                         }
                         wndclass = (Win32WndClass *)wndclass->GetNext();
@@ -155,4 +164,5 @@
         }
   }
+  leaveMutex(OBJTYPE_CLASS);
   dprintf(("Class %X (inst %X) not found!", id, hInstance));
   return(NULL);
