diff options
author | bje <bje> | 1998-07-23 15:56:11 +0000 |
---|---|---|
committer | bje <bje> | 1998-07-23 15:56:11 +0000 |
commit | 9ec36039c82951d6a097b1a028bc8216033eb7e4 (patch) | |
tree | 4055e988c7d3cc17fb49c99506885ffca8ca50fb | |
parent | a47000c791c0883b04ceab34175742d86d148340 (diff) |
1998-07-24 Ben Elliston <bje@cygnus.com>
* attr.c (pthread_attr_getdetachstate): Implement.
(pthread_attr_setdetachstate): Likewise.
-rw-r--r-- | attr.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -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) |