warn(format, arg) fprintf(stderr, idem)
# Locking/unlocking for MT operation
- MALLOC_LOCK MUTEX_LOCK_NOCONTEXT(&PL_malloc_mutex)
- MALLOC_UNLOCK MUTEX_UNLOCK_NOCONTEXT(&PL_malloc_mutex)
+ MALLOC_LOCK MUTEX_LOCK(&PL_malloc_mutex)
+ MALLOC_UNLOCK MUTEX_UNLOCK(&PL_malloc_mutex)
# Locking/unlocking mutex for MT operation
MUTEX_LOCK(l) void
#endif
#ifndef MALLOC_LOCK
-# define MALLOC_LOCK MUTEX_LOCK_NOCONTEXT(&PL_malloc_mutex)
+# define MALLOC_LOCK MUTEX_LOCK(&PL_malloc_mutex)
#endif
#ifndef MALLOC_UNLOCK
-# define MALLOC_UNLOCK MUTEX_UNLOCK_NOCONTEXT(&PL_malloc_mutex)
+# define MALLOC_UNLOCK MUTEX_UNLOCK(&PL_malloc_mutex)
#endif
# ifndef fatalcroak /* make depend */
STMT_START { \
if (pthread_detach(&(t)->self)) { \
MUTEX_UNLOCK(&(t)->mutex); \
- Perl_croak(aTHX_ "panic: DETACH"); \
+ Perl_croak_nocontext("panic: DETACH"); \
} \
} STMT_END
if (*m) { \
mutex_init(*m); \
} else { \
- Perl_croak(aTHX_ "panic: MUTEX_INIT"); \
+ Perl_croak_nocontext("panic: MUTEX_INIT"); \
} \
} STMT_END
#define MUTEX_LOCK(m) mutex_lock(*m)
-#define MUTEX_LOCK_NOCONTEXT(m) mutex_lock(*m)
#define MUTEX_UNLOCK(m) mutex_unlock(*m)
-#define MUTEX_UNLOCK_NOCONTEXT(m) mutex_unlock(*m)
#define MUTEX_DESTROY(m) \
STMT_START { \
mutex_free(*m); \
condition_init(*c); \
} \
else { \
- Perl_croak(aTHX_ "panic: COND_INIT"); \
+ Perl_croak_nocontext("panic: COND_INIT"); \
} \
} STMT_END
STMT_START { \
Zero((m), 1, perl_mutex); \
if (pthread_mutex_init((m), pthread_mutexattr_default)) \
- Perl_croak(aTHX_ "panic: MUTEX_INIT"); \
+ Perl_croak_nocontext("panic: MUTEX_INIT"); \
} STMT_END
# else
# define MUTEX_INIT(m) \
STMT_START { \
if (pthread_mutex_init((m), pthread_mutexattr_default)) \
- Perl_croak(aTHX_ "panic: MUTEX_INIT"); \
+ Perl_croak_nocontext("panic: MUTEX_INIT"); \
} STMT_END
# endif
# define MUTEX_LOCK(m) \
STMT_START { \
if (pthread_mutex_lock((m))) \
- Perl_croak(aTHX_ "panic: MUTEX_LOCK"); \
- } STMT_END
-
-# define MUTEX_UNLOCK(m) \
- STMT_START { \
- if (pthread_mutex_unlock((m))) \
- Perl_croak(aTHX_ "panic: MUTEX_UNLOCK"); \
- } STMT_END
-
-# define MUTEX_LOCK_NOCONTEXT(m) \
- STMT_START { \
- if (pthread_mutex_lock((m))) \
Perl_croak_nocontext("panic: MUTEX_LOCK"); \
} STMT_END
-# define MUTEX_UNLOCK_NOCONTEXT(m) \
+# define MUTEX_UNLOCK(m) \
STMT_START { \
if (pthread_mutex_unlock((m))) \
Perl_croak_nocontext("panic: MUTEX_UNLOCK"); \
# define MUTEX_DESTROY(m) \
STMT_START { \
if (pthread_mutex_destroy((m))) \
- Perl_croak(aTHX_ "panic: MUTEX_DESTROY"); \
+ Perl_croak_nocontext("panic: MUTEX_DESTROY"); \
} STMT_END
#endif /* MUTEX_INIT */
# define COND_INIT(c) \
STMT_START { \
if (pthread_cond_init((c), pthread_condattr_default)) \
- Perl_croak(aTHX_ "panic: COND_INIT"); \
+ Perl_croak_nocontext("panic: COND_INIT"); \
} STMT_END
# define COND_SIGNAL(c) \
STMT_START { \
if (pthread_cond_signal((c))) \
- Perl_croak(aTHX_ "panic: COND_SIGNAL"); \
+ Perl_croak_nocontext("panic: COND_SIGNAL"); \
} STMT_END
# define COND_BROADCAST(c) \
STMT_START { \
if (pthread_cond_broadcast((c))) \
- Perl_croak(aTHX_ "panic: COND_BROADCAST"); \
+ Perl_croak_nocontext("panic: COND_BROADCAST"); \
} STMT_END
# define COND_WAIT(c, m) \
STMT_START { \
if (pthread_cond_wait((c), (m))) \
- Perl_croak(aTHX_ "panic: COND_WAIT"); \
+ Perl_croak_nocontext("panic: COND_WAIT"); \
} STMT_END
# define COND_DESTROY(c) \
STMT_START { \
if (pthread_cond_destroy((c))) \
- Perl_croak(aTHX_ "panic: COND_DESTROY"); \
+ Perl_croak_nocontext("panic: COND_DESTROY"); \
} STMT_END
#endif /* COND_INIT */
STMT_START { \
if (pthread_detach((t)->self)) { \
MUTEX_UNLOCK(&(t)->mutex); \
- Perl_croak(aTHX_ "panic: DETACH"); \
+ Perl_croak_nocontext("panic: DETACH"); \
} \
} STMT_END
#endif /* DETACH */
# define JOIN(t, avp) \
STMT_START { \
if (pthread_join((t)->self, (void**)(avp))) \
- Perl_croak(aTHX_ "panic: pthread_join"); \
+ Perl_croak_nocontext("panic: pthread_join"); \
} STMT_END
#endif /* JOIN */
# define PERL_SET_CONTEXT(t) \
STMT_START { \
if (pthread_setspecific(PL_thr_key, (void *)(t))) \
- Perl_croak(aTHX_ "panic: pthread_setspecific"); \
+ Perl_croak_nocontext("panic: pthread_setspecific"); \
} STMT_END
#endif /* PERL_SET_CONTEXT */
# define MUTEX_LOCK(m)
#endif
-#ifndef MUTEX_LOCK_NOCONTEXT
-# define MUTEX_LOCK_NOCONTEXT(m)
-#endif
-
#ifndef MUTEX_UNLOCK
# define MUTEX_UNLOCK(m)
#endif
-#ifndef MUTEX_UNLOCK_NOCONTEXT
-# define MUTEX_UNLOCK_NOCONTEXT(m)
-#endif
-
#ifndef MUTEX_INIT
# define MUTEX_INIT(m)
#endif
#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
# 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"); \
# 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
(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) \
* 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--; \
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
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 */
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 */