Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 07 Nov 2002 12:34:58 +0100
From:      Mathieu Arnold <mat@mat.cc>
To:        freebsd-hackers@freebsd.org
Subject:   pthreads on 4.7-RELEASE
Message-ID:  <180816670.1036672498@andromede.reaumur.absolight.net>

next in thread | raw e-mail | index | archive | help
Hi

I'm having a bit of difficulties with pthreads, lets explain :

$ cat test.c
#include "pthread.h"

void * test (void* t) {
	while (1) {
		printf("pouet");
		sleep(1);
	}
}
main () {
	pthread_t th;

	if (pthread_create(&th, NULL, test, NULL)) {
		perror("pthread_create");
		exit(1);
	}
	if (pthread_detach(th)) {
		perror("pthread_detach");
		exit(2);
	}
	exit(0);
}
$ gcc -pthread -D_REENTRANT -D_THREAD_SAFE test.c -o test
$ ./test
pthread_create: Cannot allocate memory

I must be doing something stupid, but I cannot really find what...

-- 
Mathieu Arnold

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?180816670.1036672498>