__P

brent verner brent@rcfile.org
Mon Jun 12 18:20:00 GMT 2000


on Mon, Jun 12, 2000 at 05:25:53PM -0700, Geoff Marshall typed aloud:
| Am trying to compile some threads on Red Had Linux and see that all the
| routines in pthreads.h are prefixed with __P for example:
| 
| extern int pthread_create __P ((pthread_t *__thread,
|                 __const pthread_attr_t *__attr,
|                 void *(*__start_routine) (void *),
|                 void *__arg));
| 
| Questions:
| 
| What does __P mean?

hmm... __Pure-magic :) ??? I see you've been digging
aroung pthread.h and friends, huh? baaaad idea. the
man pages for pthread_* are quite nice. always give
'man' a shot before resorting to reading headers for
library usage :) If you need the man pages, I can
email 'em to you.

| How do I call pthread_create?

#include <pthread.h>
#include <stdio.h>

void*
runner(char* a)
{
  printf("runner() got '%s'\n", a);
  pthread_exit((void*)"return val");
}

int
main(int argc, char** argv)
{
  pthread_t thr;
  void* rv;
  pthread_create(&thr,NULL,(void*)runner,(void*)"an arg");
  pthread_join(thr,&rv);
  printf("runner() returned '%s'\n",(char*)rv);
  return 0;
}

-- 
Damon Brent Verner
Cracker Jack® Certified Professional
brent@rcfile.org, brent@linux1.org


More information about the Gcc mailing list