Deleted Added
full compact
thr_attr_init.c (17706) thr_attr_init.c (22315)
1/*
2 * Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 27 unchanged lines hidden (view full) ---

36#ifdef _THREAD_SAFE
37#include <pthread.h>
38#include "pthread_private.h"
39
40int pthread_attr_init(pthread_attr_t *attr)
41{
42 int ret;
43 pthread_attr_t pattr;
1/*
2 * Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 27 unchanged lines hidden (view full) ---

36#ifdef _THREAD_SAFE
37#include <pthread.h>
38#include "pthread_private.h"
39
40int pthread_attr_init(pthread_attr_t *attr)
41{
42 int ret;
43 pthread_attr_t pattr;
44 if ((pattr = (pthread_attr_t) malloc(sizeof(struct pthread_attr))) == NULL) {
45 errno = ENOMEM;
46 ret = -1;
47 } else {
44
45 /* Allocate memory for the attribute object: */
46 if ((pattr = (pthread_attr_t) malloc(sizeof(struct pthread_attr))) == NULL)
47 /* Insufficient memory: */
48 ret = ENOMEM;
49 else {
50 /* Initialise the attribute object with the defaults: */
48 memcpy(pattr, &pthread_attr_default, sizeof(struct pthread_attr));
51 memcpy(pattr, &pthread_attr_default, sizeof(struct pthread_attr));
52
53 /* Return a pointer to the attribute object: */
49 *attr = pattr;
50 ret = 0;
51 }
52 return(ret);
53}
54#endif
54 *attr = pattr;
55 ret = 0;
56 }
57 return(ret);
58}
59#endif