summaryrefslogtreecommitdiff
path: root/win32/win32thread.h
diff options
context:
space:
mode:
Diffstat (limited to 'win32/win32thread.h')
-rw-r--r--win32/win32thread.h36
1 files changed, 11 insertions, 25 deletions
diff --git a/win32/win32thread.h b/win32/win32thread.h
index 46c6bf5f84..809e0f7212 100644
--- a/win32/win32thread.h
+++ b/win32/win32thread.h
@@ -17,8 +17,6 @@ typedef CRITICAL_SECTION perl_mutex;
#define MUTEX_INIT(m) InitializeCriticalSection(m)
#define MUTEX_LOCK(m) EnterCriticalSection(m)
#define MUTEX_UNLOCK(m) LeaveCriticalSection(m)
-#define MUTEX_LOCK_NOCONTEXT(m) EnterCriticalSection(m)
-#define MUTEX_UNLOCK_NOCONTEXT(m) LeaveCriticalSection(m)
#define MUTEX_DESTROY(m) DeleteCriticalSection(m)
#else
@@ -27,28 +25,16 @@ typedef HANDLE perl_mutex;
# define MUTEX_INIT(m) \
STMT_START { \
if ((*(m) = CreateMutex(NULL,FALSE,NULL)) == NULL) \
- Perl_croak(aTHX_ "panic: MUTEX_INIT"); \
+ Perl_croak_nocontext("panic: MUTEX_INIT"); \
} STMT_END
# define MUTEX_LOCK(m) \
STMT_START { \
if (WaitForSingleObject(*(m),INFINITE) == WAIT_FAILED) \
- Perl_croak(aTHX_ "panic: MUTEX_LOCK"); \
- } STMT_END
-
-# define MUTEX_UNLOCK(m) \
- STMT_START { \
- if (ReleaseMutex(*(m)) == 0) \
- Perl_croak(aTHX_ "panic: MUTEX_UNLOCK"); \
- } STMT_END
-
-# define MUTEX_LOCK_NOCONTEXT(m) \
- STMT_START { \
- if (WaitForSingleObject(*(m),INFINITE) == WAIT_FAILED) \
Perl_croak_nocontext("panic: MUTEX_LOCK"); \
} STMT_END
-# define MUTEX_UNLOCK_NOCONTEXT(m) \
+# define MUTEX_UNLOCK(m) \
STMT_START { \
if (ReleaseMutex(*(m)) == 0) \
Perl_croak_nocontext("panic: MUTEX_UNLOCK"); \
@@ -57,7 +43,7 @@ typedef HANDLE perl_mutex;
# define MUTEX_DESTROY(m) \
STMT_START { \
if (CloseHandle(*(m)) == 0) \
- Perl_croak(aTHX_ "panic: MUTEX_DESTROY"); \
+ Perl_croak_nocontext("panic: MUTEX_DESTROY"); \
} STMT_END
#endif
@@ -71,21 +57,21 @@ typedef HANDLE perl_mutex;
(c)->waiters = 0; \
(c)->sem = CreateSemaphore(NULL,0,LONG_MAX,NULL); \
if ((c)->sem == NULL) \
- Perl_croak(aTHX_ "panic: COND_INIT (%ld)",GetLastError()); \
+ Perl_croak_nocontext("panic: COND_INIT (%ld)",GetLastError()); \
} STMT_END
#define COND_SIGNAL(c) \
STMT_START { \
if ((c)->waiters > 0 && \
ReleaseSemaphore((c)->sem,1,NULL) == 0) \
- Perl_croak(aTHX_ "panic: COND_SIGNAL (%ld)",GetLastError()); \
+ Perl_croak_nocontext("panic: COND_SIGNAL (%ld)",GetLastError()); \
} STMT_END
#define COND_BROADCAST(c) \
STMT_START { \
if ((c)->waiters > 0 && \
ReleaseSemaphore((c)->sem,(c)->waiters,NULL) == 0) \
- Perl_croak(aTHX_ "panic: COND_BROADCAST (%ld)",GetLastError());\
+ Perl_croak_nocontext("panic: COND_BROADCAST (%ld)",GetLastError());\
} STMT_END
#define COND_WAIT(c, m) \
@@ -96,7 +82,7 @@ typedef HANDLE perl_mutex;
* COND_BROADCAST() on another thread will have seen the\
* right number of waiters (i.e. including this one) */ \
if (WaitForSingleObject((c)->sem,INFINITE)==WAIT_FAILED)\
- Perl_croak(aTHX_ "panic: COND_WAIT (%ld)",GetLastError()); \
+ Perl_croak_nocontext("panic: COND_WAIT (%ld)",GetLastError()); \
/* XXX there may be an inconsequential race here */ \
MUTEX_LOCK(m); \
(c)->waiters--; \
@@ -106,14 +92,14 @@ typedef HANDLE perl_mutex;
STMT_START { \
(c)->waiters = 0; \
if (CloseHandle((c)->sem) == 0) \
- Perl_croak(aTHX_ "panic: COND_DESTROY (%ld)",GetLastError()); \
+ Perl_croak_nocontext("panic: COND_DESTROY (%ld)",GetLastError()); \
} STMT_END
#define DETACH(t) \
STMT_START { \
if (CloseHandle((t)->self) == 0) { \
MUTEX_UNLOCK(&(t)->mutex); \
- Perl_croak(aTHX_ "panic: DETACH"); \
+ Perl_croak_nocontext("panic: DETACH"); \
} \
} STMT_END
@@ -195,7 +181,7 @@ END_EXTERN_C
if ((WaitForSingleObject((t)->self,INFINITE) == WAIT_FAILED) \
|| (GetExitCodeThread((t)->self,(LPDWORD)(avp)) == 0) \
|| (CloseHandle((t)->self) == 0)) \
- Perl_croak(aTHX_ "panic: JOIN"); \
+ Perl_croak_nocontext("panic: JOIN"); \
*avp = (AV *)((t)->i.retv); \
} STMT_END
#else /* !USE_RTL_THREAD_API || _MSC_VER */
@@ -204,7 +190,7 @@ END_EXTERN_C
if ((WaitForSingleObject((t)->self,INFINITE) == WAIT_FAILED) \
|| (GetExitCodeThread((t)->self,(LPDWORD)(avp)) == 0) \
|| (CloseHandle((t)->self) == 0)) \
- Perl_croak(aTHX_ "panic: JOIN"); \
+ Perl_croak_nocontext("panic: JOIN"); \
} STMT_END
#endif /* !USE_RTL_THREAD_API || _MSC_VER */