thr_attr_destroy.c revision 71581
1193323Sed/* 2193323Sed * Copyright (c) 1996 John Birrell <jb@cimlogic.com.au>. 3193323Sed * All rights reserved. 4193323Sed * 5193323Sed * Redistribution and use in source and binary forms, with or without 6193323Sed * modification, are permitted provided that the following conditions 7193323Sed * are met: 8193323Sed * 1. Redistributions of source code must retain the above copyright 9193323Sed * notice, this list of conditions and the following disclaimer. 10193323Sed * 2. Redistributions in binary form must reproduce the above copyright 11193323Sed * notice, this list of conditions and the following disclaimer in the 12193323Sed * documentation and/or other materials provided with the distribution. 13193323Sed * 3. All advertising materials mentioning features or use of this software 14193323Sed * must display the following acknowledgement: 15193323Sed * This product includes software developed by John Birrell. 16193323Sed * 4. Neither the name of the author nor the names of any co-contributors 17193323Sed * may be used to endorse or promote products derived from this software 18193323Sed * without specific prior written permission. 19193323Sed * 20193323Sed * THIS SOFTWARE IS PROVIDED BY JOHN BIRRELL AND CONTRIBUTORS ``AS IS'' AND 21193323Sed * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22193323Sed * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23193323Sed * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 24193323Sed * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25193323Sed * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26193323Sed * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27193323Sed * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28193323Sed * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29193323Sed * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30193323Sed * SUCH DAMAGE. 31193323Sed * 32198090Srdivacky * $FreeBSD: head/lib/libkse/thread/thr_attr_destroy.c 71581 2001-01-24 13:03:38Z deischen $ 33193323Sed */ 34193323Sed#include <stdlib.h> 35193323Sed#include <errno.h> 36193323Sed#include <pthread.h> 37202375Srdivacky#include "pthread_private.h" 38203954Srdivacky 39193323Sed#pragma weak pthread_attr_destroy=_pthread_attr_destroy 40193323Sed 41193323Sedint 42193323Sed_pthread_attr_destroy(pthread_attr_t *attr) 43193323Sed{ 44193323Sed int ret; 45193323Sed 46193323Sed /* Check for invalid arguments: */ 47193323Sed if (attr == NULL || *attr == NULL) 48193323Sed /* Invalid argument: */ 49193323Sed ret = EINVAL; 50193323Sed else { 51193323Sed /* Free the memory allocated to the attribute object: */ 52193323Sed free(*attr); 53193323Sed 54193323Sed /* 55193323Sed * Leave the attribute pointer NULL now that the memory 56193323Sed * has been freed: 57193323Sed */ 58193323Sed *attr = NULL; 59193323Sed ret = 0; 60193323Sed } 61193323Sed return(ret); 62193323Sed} 63193323Sed