pthreads

Robert Collins robert.collins@itdomain.com.au
Tue Apr 10 05:54:00 GMT 2001


I have a working directory here that implements the following functions
(and thanks to Bernard Dautrevaux, pthread_once should be race free :])

I'm not 100% happy with the code yet - there are some known loose
ends/potential races that I need to clean up before I submit a formal
patch. However if any of you want an interim patch to play around
with/comment on I'd be happy to run it off and drop it into
cygwin-patches.

I've also got a trival patch for sys/features.h to line up with the
posix conformance we should get if this goes in.

function list for pthreads (taken against CVS - some duplicates with the
existing outstanding patch)
/* Attributes */
  int pthread_attr_getdetachstate (const pthread_attr_t *, int *);
  int pthread_attr_getinheritsched (const pthread_attr_t *, int *);
  int pthread_attr_getschedparam (const pthread_attr_t *,
                                  struct sched_param *);
  int pthread_attr_getschedpolicy (const pthread_attr_t *, int *);
  int pthread_attr_getscope (const pthread_attr_t *, int *);
  int pthread_attr_setdetachstate (pthread_attr_t *, int);
  int pthread_attr_setinheritsched (pthread_attr_t *, int);
  int pthread_attr_setschedparam (pthread_attr_t *,
                                  const struct sched_param *);
  int pthread_attr_setschedpolicy (pthread_attr_t *, int);
  int pthread_attr_setscope (pthread_attr_t *, int);
  int pthread_cancel (pthread_t);
/* these two are implemented via macros as per a suggestion in the doco
I'm using */
void pthread_cleanup_push(void (*routine)(void*), void *arg);
void pthread_cleanup_pop(int execute);
  int pthread_getschedparam (pthread_t, int *, struct sched_param *);
  int pthread_join (pthread_t, void **);
  int pthread_key_create (pthread_key_t *, void (*)(void *));
  int pthread_key_delete (pthread_key_t);

/* Mutex's */
  int pthread_mutex_getprioceiling (const pthread_mutex_t *, int *);
  int pthread_mutex_setprioceiling (pthread_mutex_t *, int, int *);
  int pthread_mutexattr_destroy (pthread_mutexattr_t *);
  int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *, int
*);
  int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *, int
*);
  int pthread_mutexattr_getpshared (const pthread_mutexattr_t *, int *);
  int pthread_mutexattr_gettype (const pthread_mutexattr_t *, int *);
  int pthread_mutexattr_init (pthread_mutexattr_t *);
  int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *, int);
  int pthread_mutexattr_setprotocol (pthread_mutexattr_t *, int);
  int pthread_mutexattr_setpshared (pthread_mutexattr_t *, int);
  int pthread_mutexattr_settype (pthread_mutexattr_t *, int);

  int pthread_once (pthread_once_t *, void (*)(void));

/* Concurrency levels - X/Open interface */
  int pthread_getconcurrency (void);
  int pthread_setconcurrency (int);

  int pthread_setcancelstate (int, int *);
  int pthread_setcanceltype (int, int *);
  int pthread_setschedparam (pthread_t, int, const struct sched_param
*);
  void pthread_testcancel (void);


Rob



More information about the Cygwin-developers mailing list