DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Threads

hello, world

#include	<stdio.h>
#include	<stdlib.h>
#include	<thread.h>
static void	*print(void*);
int main()
{
	int	okend = EXIT_SUCCESS;
	(void)thr_create(0,0, print, (void *)"hello, ",  0L,0);
	(void)thr_create(0,0, print, (void *)"world.\n", 0L,0);
	thr_exit(&okend);
	/*NOTREACHED*/
}
static void *print(void *s)
{
	(void)printf(s);
	return NULL;
}

hello, world

``hello, world'' shows the traditional first program written when one enters a new regime of the UNIX programming environment. In this example, we create one thread to output ``"hello, "'' and a separate thread to output ``"world.\n"'' Despite its brevity, this example illustrates several points about programming with the Threads Library:


Next topic: Basic threads management example
Previous topic: Examples

© 2004 The SCO Group, Inc. All rights reserved.
UnixWare 7 Release 7.1.4 - 27 April 2004