/**************************************************************************/ /* */ /* Copyright (c) Microsoft Corporation. All rights reserved. */ /* */ /* This software is licensed under the Microsoft Software License */ /* Terms for Microsoft Azure RTOS. Full text of the license can be */ /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */ /* and in the root directory of this software. */ /* */ /**************************************************************************/ /**************************************************************************/ /**************************************************************************/ /** */ /** POSIX wrapper for THREADX */ /** */ /** */ /** */ /**************************************************************************/ /**************************************************************************/ /* Include necessary system files. */ #include "tx_api.h" /* Threadx API */ #include "pthread.h" /* Posix API */ #include "px_int.h" /* Posix helper functions */ /**************************************************************************/ /* */ /* FUNCTION RELEASE */ /* */ /* pthread_attr_destroy PORTABLE C */ /* 6.x */ /* AUTHOR */ /* */ /* William E. Lamie, Microsoft Corporation */ /* */ /* DESCRIPTION */ /* */ /* This function destroys a pthread attributes object and allows the */ /* system to reclaim any resources associated with that pthread */ /* attributes object.This doesn't have an effect on any threads created*/ /* using this pthread attributes object. */ /* */ /* */ /* INPUT */ /* */ /* attr Address of the pthread attributes */ /* object to be destroyed. */ /* */ /* OUTPUT */ /* */ /* 0 If successful */ /* Value In case of any error or the results */ /* of referencing the object after it */ /* has been destroyed. */ /* */ /* CALLS */ /* */ /* None */ /* */ /* CALLED BY */ /* */ /* Application Code */ /* */ /* RELEASE HISTORY */ /* */ /* DATE NAME DESCRIPTION */ /* */ /* xx-xx-xxxx William E. Lamie Initial Version 6.x */ /* */ /**************************************************************************/ INT pthread_attr_destroy(pthread_attr_t *attr) { /* Clear the flag and make this pthread_attr structure free */ /* First check the attribute object is already destroyed? */ if (attr->inuse == TX_FALSE) return(EINVAL); else { /* No then destroy the attributes object */ attr->inuse = TX_FALSE; return(OK); } }