summaryrefslogtreecommitdiff
path: root/lib/libc_r/TEST/test_preemption.c
blob: 54ca1b9117e8262e66b67b863281da3524006ca2 (plain)
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
34
35
36
37
38
/* ==== test_pthread_cond.c =========================================
 * Copyright (c) 1993 by Chris Provenzano, proven@athena.mit.edu
 *
 * Description : Test pthread_cond(). Run this after test_create()
 *
 *  1.23 94/05/04 proven
 *      -Started coding this file.
 */

#include <pthread.h>
#include <stdio.h>
#include "test.h"

void* new_thread(void * new_buf)
{
	int i;

	printf("yielding:");
	for (i = 0; i < 10; i++) {
		printf(" %d", i);
		fflush(stdout);
		pthread_yield();
	}
	printf("\n");
	SUCCEED;
}

int
main()
{
	pthread_t thread;

	CHECKr(pthread_create(&thread, NULL, new_thread, NULL));

	while(1)
		;
	PANIC("while");
}