thr_mattr_init.c (19633) | thr_mattr_init.c (31402) |
---|---|
1/* 2 * Copyright (c) 1996 Jeffrey Hsu <hsu@freebsd.org>. 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_mutexattr_init(pthread_mutexattr_t *attr) 42{ 43 int ret; 44 pthread_mutexattr_t pattr; 45 46 if ((pattr = (pthread_mutexattr_t) 47 malloc(sizeof(struct pthread_mutex_attr))) == NULL) { | 1/* 2 * Copyright (c) 1996 Jeffrey Hsu <hsu@freebsd.org>. 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_mutexattr_init(pthread_mutexattr_t *attr) 42{ 43 int ret; 44 pthread_mutexattr_t pattr; 45 46 if ((pattr = (pthread_mutexattr_t) 47 malloc(sizeof(struct pthread_mutex_attr))) == NULL) { |
48 errno = ENOMEM; 49 ret = -1; | 48 ret = ENOMEM; |
50 } else { 51 memcpy(pattr, &pthread_mutexattr_default, 52 sizeof(struct pthread_mutex_attr)); 53 *attr = pattr; 54 ret = 0; 55 } 56 return(ret); 57} 58#endif | 49 } else { 50 memcpy(pattr, &pthread_mutexattr_default, 51 sizeof(struct pthread_mutex_attr)); 52 *attr = pattr; 53 ret = 0; 54 } 55 return(ret); 56} 57#endif |