Date: Sun, 30 Jan 2005 07:44:00 GMT From: David Xu <davidxu@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 69958 for review Message-ID: <200501300744.j0U7i0hr096790@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=69958 Change 69958 by davidxu@davidxu_tiger on 2005/01/30 07:43:19 Add pthread_condattr_setclock, pthread_condattr_getclock. Affected files ... .. //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_condattr.c#4 edit Differences ... ==== //depot/projects/davidxu_thread/src/lib/libthread/thread/thr_condattr.c#4 (text+ko) ==== @@ -39,12 +39,16 @@ __weak_reference(_pthread_condattr_init, pthread_condattr_init); __weak_reference(_pthread_condattr_destroy, pthread_condattr_destroy); +__weak_reference(_pthread_condattr_getclock, pthread_condattr_getclock); +__weak_reference(_pthread_condattr_setclock, pthread_condattr_setclock); +__weak_reference(_pthread_condattr_getpshared, pthread_condattr_getpshared); +__weak_reference(_pthread_condattr_setpshared, pthread_condattr_setpshared); int _pthread_condattr_init(pthread_condattr_t *attr) { + pthread_condattr_t pattr; int ret; - pthread_condattr_t pattr; if ((pattr = (pthread_condattr_t) malloc(sizeof(struct pthread_cond_attr))) == NULL) { @@ -62,6 +66,7 @@ _pthread_condattr_destroy(pthread_condattr_t *attr) { int ret; + if (attr == NULL || *attr == NULL) { ret = EINVAL; } else { @@ -71,3 +76,51 @@ } return(ret); } + +int +_pthread_condattr_getclock(const pthread_condattr_t *attr, + clockid_t *clock_id) +{ + if (attr == NULL || *attr == NULL) + return (EINVAL); + *clock_id = (*attr)->c_clockid; + return (0); +} + +int +_pthread_condattr_setclock(const pthread_condattr_t *attr, + clockid_t clock_id) +{ + if (attr == NULL || *attr == NULL) + return (EINVAL); + if (clock_id != CLOCK_REALTIME && + clock_id != CLOCK_VIRTUAL && + clock_id != CLOCK_PROF && + clock_id != CLOCK_MONOTONIC) { + return (EINVAL); + } + (*attr)->c_clockid = clock_id; + return (0); +} + +int +_pthread_condattr_getpshared(const pthread_condattr_t *attr, + int *pshared) +{ + if (attr == NULL || *attr == NULL) + return (EINVAL); + + pshared = PTHREAD_PROCESS_PRIVATE; + return (0); +} + +int +_pthread_condattr_setpshared(pthread_condattr_t *attr, int pshared) +{ + if (attr == NULL || *attr == NULL) + return (EINVAL); + + if (pshared != PTHREAD_PROCESS_PRIVATE) + return (EINVAL); + return (0); +}
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200501300744.j0U7i0hr096790>