aboutsummaryrefslogtreecommitdiff
path: root/c/atexit/main.c
blob: 1729edfce2abbd06cf6dd1c2d632a56e5de4e41a (plain) (blame)
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
28
29
30
31
32
33
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

static void *loop(void *);
static void handler(void);

int
main(void)
{
	pthread_t t;

	atexit(handler);
	pthread_create(&t, NULL, loop, NULL);
	sleep(1);
	return EXIT_SUCCESS;
}

void *
loop(void *_)
{
	(void)_;
	for (;;)
		;
	return NULL;
}

void
handler(void)
{
	puts("hello, world!");
}