mirror of
https://github.com/jemalloc/jemalloc.git
synced 2026-07-23 13:13:06 +00:00
Add mq (message queue) to test infrastructure.
Add mtx (mutex) to test infrastructure, in order to avoid bootstrapping complications that would result from directly using malloc_mutex. Rename test infrastructure's thread abstraction from je_thread to thd. Fix some header ordering issues.
This commit is contained in:
21
test/include/test/mtx.h
Normal file
21
test/include/test/mtx.h
Normal file
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* mtx is a slightly simplified version of malloc_mutex. This code duplication
|
||||
* is unfortunate, but there are allocator bootstrapping considerations that
|
||||
* would leak into the test infrastructure if malloc_mutex were used directly
|
||||
* in tests.
|
||||
*/
|
||||
|
||||
typedef struct {
|
||||
#ifdef _WIN32
|
||||
CRITICAL_SECTION lock;
|
||||
#elif (defined(JEMALLOC_OSSPIN))
|
||||
OSSpinLock lock;
|
||||
#else
|
||||
pthread_mutex_t lock;
|
||||
#endif
|
||||
} mtx_t;
|
||||
|
||||
bool mtx_init(mtx_t *mtx);
|
||||
void mtx_fini(mtx_t *mtx);
|
||||
void mtx_lock(mtx_t *mtx);
|
||||
void mtx_unlock(mtx_t *mtx);
|
||||
Reference in New Issue
Block a user