File: pthread.c

package info (click to toggle)
python-ptrace 0.9.9-0.2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 788 kB
  • sloc: python: 10,167; ansic: 263; makefile: 164
file content (27 lines) | stat: -rw-r--r-- 523 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include <pthread.h>
#include <stdio.h>

#define UNUSED(x) x __attribute__((unused))

pthread_t thread;
pthread_mutex_t mutex;
int global_counter;

void* nothing(void *UNUSED(data))
{
    printf("[thread] exit thread\n");
    pthread_exit(NULL);
}

int main()
{
    global_counter = 1;

    printf("[main] create thread\n");
    pthread_create(&thread, NULL, nothing, NULL);
    printf("[main] join thread\n");
    pthread_join(thread, NULL);
    printf("[main] exit\n");
    pthread_mutex_destroy(&mutex);
    return 0;
}