diff options
author | julian <julian@FreeBSD.org> | 1997-02-05 23:26:09 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1997-02-05 23:26:09 +0000 |
commit | c2f7c3e4893b6b5c4494d549b3645e06664bc1b1 (patch) | |
tree | b2e6d3017e236268263978b585f2150cd10b1689 /lib/libpthread/thread/thr_attr_init.c | |
parent | 321f03c8eddd8cf5aa81836ff1932a74156d30cb (diff) | |
download | FreeBSD-src-c2f7c3e4893b6b5c4494d549b3645e06664bc1b1.zip FreeBSD-src-c2f7c3e4893b6b5c4494d549b3645e06664bc1b1.tar.gz |
Submitted by: John Birrell
uthreads update from the author.
Diffstat (limited to 'lib/libpthread/thread/thr_attr_init.c')
-rw-r--r-- | lib/libpthread/thread/thr_attr_init.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/libpthread/thread/thr_attr_init.c b/lib/libpthread/thread/thr_attr_init.c index 7dade97..c64e29f 100644 --- a/lib/libpthread/thread/thr_attr_init.c +++ b/lib/libpthread/thread/thr_attr_init.c @@ -41,11 +41,16 @@ int pthread_attr_init(pthread_attr_t *attr) { int ret; pthread_attr_t pattr; - if ((pattr = (pthread_attr_t) malloc(sizeof(struct pthread_attr))) == NULL) { - errno = ENOMEM; - ret = -1; - } else { + + /* Allocate memory for the attribute object: */ + if ((pattr = (pthread_attr_t) malloc(sizeof(struct pthread_attr))) == NULL) + /* Insufficient memory: */ + ret = ENOMEM; + else { + /* Initialise the attribute object with the defaults: */ memcpy(pattr, &pthread_attr_default, sizeof(struct pthread_attr)); + + /* Return a pointer to the attribute object: */ *attr = pattr; ret = 0; } |