MCPcopy Create free account
hub / github.com/acl-dev/acl / test_thread

Function test_thread

lib_acl/samples/thread/thread1/main.c:109–130  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

107static pthread_mutex_t mutex_init2 = PTHREAD_MUTEX_INITIALIZER;
108
109static void test_thread(void)
110{
111 acl_pthread_t tid;
112 acl_pthread_attr_t attr;
113 THREAD_CTX ctx, *pctx;
114 void *return_arg;
115 unsigned int id;
116
117 acl_pthread_mutex_lock(&mutex_init1);
118 printf("lock mutex_init1 ok\n");
119 acl_pthread_mutex_lock(&mutex_init2);
120 printf("lock mutex_init2 ok\n");
121
122 ctx.i = 0;
123 acl_pthread_attr_init(&attr);
124 acl_pthread_create(&tid, &attr, test_thread_fn, &ctx);
125 acl_pthread_join(tid, (void**) &return_arg);
126 pctx = (THREAD_CTX*) return_arg;
127 memcpy(&id, &tid, sizeof(id));
128 printf("ctx.i=%d, pctx->i=%d, the thread id is: %u\r\n",
129 ctx.i, pctx->i, id);
130}
131#endif
132
133static void free_vstring(void *arg)

Callers 1

mainFunction · 0.70

Calls 5

acl_pthread_mutex_lockFunction · 0.85
acl_pthread_attr_initFunction · 0.85
acl_pthread_createFunction · 0.85
acl_pthread_joinFunction · 0.85
memcpyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…