thr_condattr_init.c (22315) | thr_condattr_init.c (31402) |
---|---|
1/* 2 * Copyright (c) 1997 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 --- 31 unchanged lines hidden (view full) --- 40int 41pthread_condattr_init(pthread_condattr_t *attr) 42{ 43 int ret; 44 pthread_condattr_t pattr; 45 46 if ((pattr = (pthread_condattr_t) 47 malloc(sizeof(struct pthread_cond_attr))) == NULL) { | 1/* 2 * Copyright (c) 1997 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 --- 31 unchanged lines hidden (view full) --- 40int 41pthread_condattr_init(pthread_condattr_t *attr) 42{ 43 int ret; 44 pthread_condattr_t pattr; 45 46 if ((pattr = (pthread_condattr_t) 47 malloc(sizeof(struct pthread_cond_attr))) == NULL) { |
48 errno = ENOMEM; 49 ret = -1; | 48 ret = ENOMEM; |
50 } else { 51 memcpy(pattr, &pthread_condattr_default, 52 sizeof(struct pthread_cond_attr)); 53 *attr = pattr; 54 ret = 0; 55 } 56 return(ret); 57} 58#endif | 49 } else { 50 memcpy(pattr, &pthread_condattr_default, 51 sizeof(struct pthread_cond_attr)); 52 *attr = pattr; 53 ret = 0; 54 } 55 return(ret); 56} 57#endif |