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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to