MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / thd_start

Function thd_start

deps/jemalloc/test/unit/tsd.c:46–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44}
45
46static void *
47thd_start(void *arg) {
48 int d = (int)(uintptr_t)arg;
49 void *p;
50
51 tsd_t *tsd = tsd_fetch();
52 assert_x_eq(tsd_test_data_get(tsd), MALLOC_TSD_TEST_DATA_INIT,
53 "Initial tsd get should return initialization value");
54
55 p = malloc(1);
56 assert_ptr_not_null(p, "Unexpected malloc() failure");
57
58 tsd_test_data_set(tsd, d);
59 assert_x_eq(tsd_test_data_get(tsd), d,
60 "After tsd set, tsd get should return value that was set");
61
62 d = 0;
63 assert_x_eq(tsd_test_data_get(tsd), (int)(uintptr_t)arg,
64 "Resetting local data should have no effect on tsd");
65
66 tsd_test_callback_set(tsd, &data_cleanup);
67
68 free(p);
69 return NULL;
70}
71
72TEST_BEGIN(test_tsd_main_thread) {
73 thd_start((void *)(uintptr_t)0xa5f3e329);

Callers 1

tsd.cFile · 0.70

Calls 3

mallocFunction · 0.85
freeFunction · 0.85
tsd_fetchFunction · 0.50

Tested by

no test coverage detected