summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbje <bje>1998-07-23 15:56:11 +0000
committerbje <bje>1998-07-23 15:56:11 +0000
commit9ec36039c82951d6a097b1a028bc8216033eb7e4 (patch)
tree4055e988c7d3cc17fb49c99506885ffca8ca50fb
parenta47000c791c0883b04ceab34175742d86d148340 (diff)
1998-07-24 Ben Elliston <bje@cygnus.com>
* attr.c (pthread_attr_getdetachstate): Implement. (pthread_attr_setdetachstate): Likewise.
-rw-r--r--attr.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/attr.c b/attr.c
index 6f89672..0e72575 100644
--- a/attr.c
+++ b/attr.c
@@ -100,12 +100,45 @@ pthread_attr_init(pthread_attr_t *attr)
attr->cancelability = PTHREAD_CANCEL_ENABLE;
attr->canceltype = PTHREAD_CANCEL_DEFERRED;
+ attr->detached = PTHREAD_CREATE_JOINABLE;
attr->valid = 0;
return 0;
}
int
+pthread_attr_getdetachstate(const pthread_attr_t *attr,
+ int *detachstate)
+{
+ if (is_attr(attr) != 0 || detachstate == NULL)
+ {
+ return EINVAL;
+ }
+
+ *detachstate = attr->detached;
+ return 0;
+}
+
+int
+pthread_attr_setdetachstate(pthread_attr_t *attr,
+ int detachstate)
+{
+ if (is_attr(attr) != 0)
+ {
+ return EINVAL;
+ }
+
+ if (detachstate != PTHREAD_CREATE_JOINABLE ||
+ detachstate != PTHREAD_CREATE_DETACHED)
+ {
+ return EINVAL;
+ }
+
+ attr->detached = detachstate;
+ return 0;
+}
+
+int
pthread_attr_destroy(pthread_attr_t *attr)
{
if (is_attr(attr) != 0)