thr_attr_destroy.c (17706) | thr_attr_destroy.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 --- 25 unchanged lines hidden (view full) --- 34#include <errno.h> 35#ifdef _THREAD_SAFE 36#include <pthread.h> 37#include "pthread_private.h" 38 39int pthread_attr_destroy(pthread_attr_t *attr) 40{ 41 int ret; | 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 --- 25 unchanged lines hidden (view full) --- 34#include <errno.h> 35#ifdef _THREAD_SAFE 36#include <pthread.h> 37#include "pthread_private.h" 38 39int pthread_attr_destroy(pthread_attr_t *attr) 40{ 41 int ret; |
42 if (attr == NULL || *attr == NULL) { 43 errno = EINVAL; 44 ret = -1; 45 } else { | 42 43 /* Check for invalid arguments: */ 44 if (attr == NULL || *attr == NULL) 45 /* Invalid argument: */ 46 ret = EINVAL; 47 else { 48 /* Free the memory allocated to the attribute object: */ |
46 free(*attr); | 49 free(*attr); |
50 51 /* 52 * Leave the attribute pointer NULL now that the memory 53 * has been freed: 54 */ |
|
47 *attr = NULL; 48 ret = 0; 49 } 50 return(ret); 51} 52#endif | 55 *attr = NULL; 56 ret = 0; 57 } 58 return(ret); 59} 60#endif |