]>
git.proxmox.com Git - rustc.git/blob - src/jemalloc/test/unit/mtx.c
1 #include "test/jemalloc_test.h"
6 TEST_BEGIN(test_mtx_basic
)
10 assert_false(mtx_init(&mtx
), "Unexpected mtx_init() failure");
25 thd_start_arg_t
*arg
= (thd_start_arg_t
*)varg
;
28 for (i
= 0; i
< NINCRS
; i
++) {
31 mtx_unlock(&arg
->mtx
);
36 TEST_BEGIN(test_mtx_race
)
42 assert_false(mtx_init(&arg
.mtx
), "Unexpected mtx_init() failure");
44 for (i
= 0; i
< NTHREADS
; i
++)
45 thd_create(&thds
[i
], thd_start
, (void *)&arg
);
46 for (i
= 0; i
< NTHREADS
; i
++)
47 thd_join(thds
[i
], NULL
);
48 assert_u_eq(arg
.x
, NTHREADS
* NINCRS
,
49 "Race-related counter corruption");