Changeset 1391 for branches/GNU/src/gcc/libjava/include/win32-threads.h
- Timestamp:
- Apr 27, 2004, 8:39:34 PM (22 years ago)
- Location:
- branches/GNU/src/gcc
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
libjava/include/win32-threads.h (modified) (7 diffs, 1 prop)
Legend:
- Unmodified
- Added
- Removed
-
branches/GNU/src/gcc
- Property svn:ignore
-
old new 26 26 configure.vr 27 27 configure.vrs 28 28 29 Makefile 29 dir.info30 30 lost+found 31 31 update.out
-
- Property svn:ignore
-
branches/GNU/src/gcc/libjava/include/win32-threads.h
-
Property cvs2svn:cvs-rev
changed from
1.1to1.1.1.2
r1390 r1391 2 2 // win32-threads.h - Defines for using Win32 threads. 3 3 4 /* Copyright (C) 1998, 1999, 2000 Free Software Foundation 4 /* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Free Software 5 Foundation 5 6 6 7 This file is part of libgcj. … … 19 20 // 20 21 21 typedef struct _Jv_ConditionVariable_t { 22 typedef struct 23 { 24 // ev[0] (signal) is a Win32 auto-reset event for _Jv_CondNotify 25 // ev[1] (broadcast) is a Win32 manual-reset event for _Jv_CondNotifyAll 22 26 HANDLE ev[2]; 27 28 29 30 31 23 32 CRITICAL_SECTION count_mutex; 24 int blocked_count;25 };26 33 27 typedef CRITICAL_SECTION _Jv_Mutex_t; 34 } _Jv_ConditionVariable_t; 35 36 typedef struct 37 { 38 // The thread-id of the owner thread if any, 0 otherwise 39 DWORD owner; 40 41 // Track nested mutex acquisitions by the same thread 42 int refcount; 43 44 // The actual Windows construct used to implement this mutex 45 CRITICAL_SECTION cs; 46 47 } _Jv_Mutex_t; 28 48 29 49 typedef struct … … 33 53 java::lang::Thread *thread_obj; 34 54 } _Jv_Thread_t; 55 56 57 58 59 60 61 62 35 63 36 64 typedef void _Jv_ThreadStartFunc (java::lang::Thread *); … … 53 81 inline void _Jv_MutexInit (_Jv_Mutex_t *mu) 54 82 { 55 InitializeCriticalSection(mu); 83 mu->owner = 0UL; 84 mu->refcount = 0; 85 InitializeCriticalSection (&(mu->cs)); 56 86 } 57 87 … … 59 89 inline void _Jv_MutexDestroy (_Jv_Mutex_t *mu) 60 90 { 61 DeleteCriticalSection(mu); 91 mu->owner = 0UL; 92 mu->refcount = 0; 93 DeleteCriticalSection (&(mu->cs)); 62 94 mu = NULL; 63 95 } … … 65 97 inline int _Jv_MutexUnlock (_Jv_Mutex_t *mu) 66 98 { 67 LeaveCriticalSection(mu); 68 return 0; 99 if (mu->owner == GetCurrentThreadId ( )) 100 { 101 mu->refcount--; 102 if (mu->refcount == 0) 103 mu->owner = 0UL; 104 LeaveCriticalSection (&(mu->cs)); 105 return 0; 106 } 107 else 108 return 1; 69 109 } 70 110 71 111 inline int _Jv_MutexLock (_Jv_Mutex_t *mu) 72 112 { 73 EnterCriticalSection(mu); 113 EnterCriticalSection (&(mu->cs)); 114 mu->owner = GetCurrentThreadId ( ); 115 mu->refcount++; 74 116 return 0; 75 117 } … … 97 139 inline void _Jv_ThreadYield (void) 98 140 { 99 // FIXME: win98 freezes hard (OS hang) when we use this -- 100 // for now, we simply don't yield 101 // Sleep (0); 141 Sleep (0); 102 142 } 103 143 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.
