MCPcopy Create free account
hub / github.com/Vector35/debugger / main

Function main

test/src/helloworld_thread.c:54–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52}
53
54int main(int ac, char **av)
55{
56 printf("Before Thread\n");
57
58#if defined(OS_IS_WINDOWS)
59 DWORD ids[4] = {0, 1, 2, 3};
60 HANDLE hThreadArray[4];
61 hThreadArray[0] = CreateThread(NULL, 0, ThreadFunc, (void *)(ids+0), 0, NULL);
62 hThreadArray[1] = CreateThread(NULL, 0, ThreadFunc, (void *)(ids+1), 0, NULL);
63 hThreadArray[2] = CreateThread(NULL, 0, ThreadFunc, (void *)(ids+2), 0, NULL);
64 hThreadArray[3] = CreateThread(NULL, 0, ThreadFunc, (void *)(ids+3), 0, NULL);
65 WaitForMultipleObjects(4, hThreadArray, TRUE, INFINITE);
66#else
67 int ids[4] = {0, 1, 2, 3};
68 pthread_t thread_id[4];
69 pthread_create(&thread_id[0], NULL, thread_func, (void *)(ids+0));
70 pthread_create(&thread_id[1], NULL, thread_func, (void *)(ids+1));
71 pthread_create(&thread_id[2], NULL, thread_func, (void *)(ids+2));
72 pthread_create(&thread_id[3], NULL, thread_func, (void *)(ids+3));
73 pthread_join(thread_id[0], NULL);
74 pthread_join(thread_id[1], NULL);
75 pthread_join(thread_id[2], NULL);
76 pthread_join(thread_id[3], NULL);
77#endif
78
79 return 12;
80}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected