What's wrong with this simple thread example?
From: jsmithe8 (jsmithe8_at_NOSPAM.netscape.net)
Date: 09/21/04
- Next message: Lew Pitcher: "Re: What's wrong with this simple thread example?"
- Previous message: Stephen: "Re: Linux Kernel module programming: Where am i getting wrong...?"
- Next in thread: Lew Pitcher: "Re: What's wrong with this simple thread example?"
- Reply: Lew Pitcher: "Re: What's wrong with this simple thread example?"
- Reply: Larry I Smith: "Re: What's wrong with this simple thread example?"
- Reply: jsmithe8: "Re: What's wrong with this simple thread example?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 21 Sep 2004 12:15:52 +1000
Does anyone know what's wrong with this code, I'm trying to get threads to
work on redhat linux. It won't compile.
Thanks in advance.
#include <unistd.h>
#include <pthread.h>
#include <stdio.h>
#include <sys/types.h>
#define _REENTRANT
pthread_t thr_a, main_thr;
void* a(void* arg){
printf("Thread a");
pthread_exit ((void *)main_thr);
}
void main(){
int junk;
main_thr = pthread_self();
if (pthread_create(&thr_a,NULL, a, NULL))
printf("Can't create thr_a\n");
}
- Next message: Lew Pitcher: "Re: What's wrong with this simple thread example?"
- Previous message: Stephen: "Re: Linux Kernel module programming: Where am i getting wrong...?"
- Next in thread: Lew Pitcher: "Re: What's wrong with this simple thread example?"
- Reply: Lew Pitcher: "Re: What's wrong with this simple thread example?"
- Reply: Larry I Smith: "Re: What's wrong with this simple thread example?"
- Reply: jsmithe8: "Re: What's wrong with this simple thread example?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|