- Timestamp:
- Aug 24, 1999, 11:20:30 AM (26 years ago)
- Location:
- trunk/src/user32/new
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/user32/new/gen_object.cpp
r308 r655 1 /* $Id: gen_object.cpp,v 1. 2 1999-07-15 12:01:31sandervl Exp $ */1 /* $Id: gen_object.cpp,v 1.3 1999-08-24 09:20:30 sandervl Exp $ */ 2 2 /* 3 3 * Generic Object Class for OS/2 … … 13 13 #include <gen_object.h> 14 14 #include <misc.h> 15 #include <vmutex.h> 15 16 16 HMTX genMutexSem = 0;17 VMutex genMutex[OBJTYPE_MAX]; 17 18 18 19 //****************************************************************************** … … 20 21 GenericObject::GenericObject(GenericObject **head, DWORD objType) 21 22 { 22 APIRET rc;23 24 23 this->objType = objType; 25 24 this->head = head; 26 25 this->next = NULL; 27 26 28 if(genMutexSem == 0) { 29 rc = DosCreateMutexSem(NULL, &genMutexSem, 0, FALSE); 30 if(rc) { 31 dprintf(("GenericObject ctor: DosCreateMutexSem returned %d", rc)); 32 DebugInt3(); 33 exit(1); 34 } 35 } 36 //insert in linked list 37 rc = DosRequestMutexSem(genMutexSem, SEM_INDEFINITE_WAIT); 38 if(rc) { 39 dprintf(("GenericObject ctor: DosRequestMutexSem returned %d", rc)); 40 DebugInt3(); 41 } 27 genMutex[objType].enter(); 42 28 if(*head == NULL) { 43 29 *head = this; … … 51 37 cur->next = this; 52 38 } 53 DosReleaseMutexSem(genMutexSem);39 genMutex[objType].leave(); 54 40 } 55 41 //****************************************************************************** … … 57 43 GenericObject::~GenericObject() 58 44 { 59 APIRET rc;60 61 45 //remove from linked list 62 rc = DosRequestMutexSem(genMutexSem, SEM_INDEFINITE_WAIT); 63 if(rc) { 64 dprintf(("GenericObject dtor: DosRequestMutexSem returned %d", rc)); 65 DebugInt3(); 66 } 46 genMutex[objType].enter(); 67 47 if(*head == this) { 68 48 *head = next; … … 80 60 cur->next = next; 81 61 } 82 DosReleaseMutexSem(genMutexSem);62 genMutex[objType].leave(); 83 63 } 84 64 //****************************************************************************** 85 65 //****************************************************************************** 66 void GenericObject::enterMutex() 67 { 68 genMutex[objType].enter(); 69 } 70 //****************************************************************************** 71 //****************************************************************************** 72 void GenericObject::leaveMutex() 73 { 74 genMutex[objType].leave(); 75 } 76 //****************************************************************************** 77 //****************************************************************************** 78 void GenericObject::enterMutex(DWORD objType) 79 { 80 genMutex[objType].enter(); 81 } 82 //****************************************************************************** 83 //****************************************************************************** 84 void GenericObject::leaveMutex(DWORD objType) 85 { 86 genMutex[objType].leave(); 87 } 88 //****************************************************************************** 89 //****************************************************************************** -
trunk/src/user32/new/gen_object.h
r300 r655 1 /* $Id: gen_object.h,v 1. 1 1999-07-14 08:35:34sandervl Exp $ */1 /* $Id: gen_object.h,v 1.2 1999-08-24 09:20:30 sandervl Exp $ */ 2 2 /* 3 3 * Generic Object Class for OS/2 … … 16 16 #define OBJTYPE_CURSOR 5 17 17 #define OBJTYPE_MENU 6 18 19 #define OBJTYPE_MAX 7 18 20 //...... 19 21 … … 30 32 GenericObject *GetNext() { return next; }; 31 33 32 34 void enterMutex(); 35 void leaveMutex(); 36 37 static void enterMutex(DWORD objType); 38 static void leaveMutex(DWORD objType); 39 33 40 private: 34 41 -
trunk/src/user32/new/win32class.cpp
r606 r655 1 /* $Id: win32class.cpp,v 1. 6 1999-08-21 12:53:28sandervl Exp $ */1 /* $Id: win32class.cpp,v 1.7 1999-08-24 09:20:30 sandervl Exp $ */ 2 2 /* 3 3 * Win32 Window Class Managment Code for OS/2 … … 120 120 Win32WndClass *Win32WndClass::FindClass(HINSTANCE hInstance, LPSTR id) 121 121 { 122 enterMutex(OBJTYPE_CLASS); 123 122 124 Win32WndClass *wndclass = (Win32WndClass *)wndclasses; 123 125 124 if(wndclass == NULL) return(NULL); 126 if(wndclass == NULL) { 127 leaveMutex(OBJTYPE_CLASS); 128 return(NULL); 129 } 125 130 126 131 if(HIWORD(id) != 0) { 127 132 //CB: read comment below! 128 133 if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) { 134 leaveMutex(OBJTYPE_CLASS); 129 135 return(wndclass); 130 136 } … … 133 139 while(wndclass != NULL) { 134 140 if(stricmp(wndclass->classNameA, id) == 0 && wndclass->hInstance == hInstance) { 141 leaveMutex(OBJTYPE_CLASS); 135 142 return(wndclass); 136 143 } … … 143 150 //CB: need more code to compare instance; convert 0 to exe module handle 144 151 if(wndclass->classAtom == (DWORD)id /*&& wndclass->hInstance == hInstance*/) { 152 leaveMutex(OBJTYPE_CLASS); 145 153 return(wndclass); 146 154 } … … 149 157 while(wndclass != NULL) { 150 158 if(wndclass->classAtom == (DWORD)id/* && wndclass->hInstance == hInstance*/) { 151 return(wndclass); 159 leaveMutex(OBJTYPE_CLASS); 160 return(wndclass); 152 161 } 153 162 wndclass = (Win32WndClass *)wndclass->GetNext(); … … 155 164 } 156 165 } 166 leaveMutex(OBJTYPE_CLASS); 157 167 dprintf(("Class %X (inst %X) not found!", id, hInstance)); 158 168 return(NULL);
Note:
See TracChangeset
for help on using the changeset viewer.