Example Posix, wath's wrong ?

Matteo matteo.posterli at studenti.unipr.it
Thu Feb 16 10:09:28 UTC 2006


Hi
What's wrong in so this simple example of posix threads ? I have error when I
launch it on the pthread_create and pthread_join .
I compile it correctly using the makefile of hello world.

#include <sched.h>
#include <bsp.h>
#include <stdlib.h>
#include <stdio.h>
#include <pthread.h>

void * print_hello(void * arg){
  sleep(1);
  printf("<child>: Hello World!\n");
  return NULL;
  }
int main(){
  pthread_t child;
  if ( pthread_create( &child, NULL, print_hello, NULL )) perror("Error on create");
  printf("<main>: Wait for child thread...\n");
  if ( pthread_join( child, NULL )) perror ("Error on join");
  return 0;
  }
#define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
#define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
#define CONFIGURE_MAXIMUM_POSIX_THREADS              10
#define CONFIGURE_MAXIMUM_POSIX_CONDITION_VARIABLES  10
#define CONFIGURE_MAXIMUM_POSIX_MUTEXES              10
#define CONFIGURE_POSIX_INIT_THREAD_TABLE
#include <rtems/confdefs.h>

I configure my rtems 4.6.99 for c,c++ and posix, infact I can use correctly the
psx testsuit and launch the other samples.

Thanks in advance .

Matteo





More information about the users mailing list