PERFORCE change 69958 for review
David Xu
davidxu at FreeBSD.org
Sat Jan 29 23:44:01 PST 2005
http://perforce.freebsd.org/chv.cgi?CH=69958
Change 69958 by davidxu at 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);
+}
More information about the p4-projects
mailing list