brintos

brintos / llvm-project-archived public Read only

0
0
Text · 628 B · 6834f06 Raw
37 lines · c
1#include <stdio.h>2#include <pthread.h>3#include <unistd.h>4 5int threads_up_and_running = 0;6 7void *8second_thread (void *in)9{10    pthread_setname_np ("second thread");11    while (1) 12        sleep (1);13    return NULL;14}15 16void *17third_thread (void *in)18{19    pthread_setname_np ("third thread");20    while (1) 21        sleep (1);22    return NULL;23}24 25int main ()26{27    pthread_setname_np ("main thread");28    pthread_t other_thread;29    pthread_create (&other_thread, NULL, second_thread, NULL);30    pthread_create (&other_thread, NULL, third_thread, NULL);31 32    threads_up_and_running = 1;33 34    while (1)35        sleep (1);36}37