mirror of
https://github.com/eclipse-threadx/threadx.git
synced 2025-11-16 12:34:48 +00:00
112 lines
5.2 KiB
C
112 lines
5.2 KiB
C
/***************************************************************************
|
|
* Copyright (c) 2024 Microsoft Corporation
|
|
*
|
|
* This program and the accompanying materials are made available under the
|
|
* terms of the MIT License which is available at
|
|
* https://opensource.org/licenses/MIT.
|
|
*
|
|
* SPDX-License-Identifier: MIT
|
|
**************************************************************************/
|
|
|
|
|
|
/**************************************************************************/
|
|
/**************************************************************************/
|
|
/** */
|
|
/** ThreadX Component */
|
|
/** */
|
|
/** Thread */
|
|
/** */
|
|
/**************************************************************************/
|
|
/**************************************************************************/
|
|
|
|
#define TX_SOURCE_CODE
|
|
|
|
|
|
/* Include necessary system files. */
|
|
|
|
#include "tx_api.h"
|
|
#include "tx_thread.h"
|
|
|
|
|
|
/**************************************************************************/
|
|
/* */
|
|
/* FUNCTION RELEASE */
|
|
/* */
|
|
/* _txe_thread_delete PORTABLE C */
|
|
/* 6.1 */
|
|
/* AUTHOR */
|
|
/* */
|
|
/* William E. Lamie, Microsoft Corporation */
|
|
/* */
|
|
/* DESCRIPTION */
|
|
/* */
|
|
/* This function checks for errors in the thread delete function call. */
|
|
/* */
|
|
/* INPUT */
|
|
/* */
|
|
/* thread_ptr Pointer to thread to suspend */
|
|
/* */
|
|
/* OUTPUT */
|
|
/* */
|
|
/* TX_THREAD_ERROR Invalid thread pointer */
|
|
/* TX_CALLER_ERROR Invalid caller of function */
|
|
/* status Actual completion status */
|
|
/* */
|
|
/* CALLS */
|
|
/* */
|
|
/* _tx_thread_delete Actual thread delete function */
|
|
/* */
|
|
/* CALLED BY */
|
|
/* */
|
|
/* Application code */
|
|
/* */
|
|
/* RELEASE HISTORY */
|
|
/* */
|
|
/* DATE NAME DESCRIPTION */
|
|
/* */
|
|
/* 05-19-2020 William E. Lamie Initial Version 6.0 */
|
|
/* 09-30-2020 Yuxin Zhou Modified comment(s), */
|
|
/* resulting in version 6.1 */
|
|
/* */
|
|
/**************************************************************************/
|
|
UINT _txe_thread_delete(TX_THREAD *thread_ptr)
|
|
{
|
|
|
|
UINT status;
|
|
|
|
|
|
/* Check for invalid caller of this function. */
|
|
if (TX_THREAD_GET_SYSTEM_STATE() != ((ULONG) 0))
|
|
{
|
|
|
|
/* Invalid caller of this function, return appropriate error code. */
|
|
status = TX_CALLER_ERROR;
|
|
}
|
|
|
|
/* Check for an invalid thread pointer. */
|
|
else if (thread_ptr == TX_NULL)
|
|
{
|
|
|
|
/* Thread pointer is invalid, return appropriate error code. */
|
|
status = TX_THREAD_ERROR;
|
|
}
|
|
|
|
/* Now check for invalid thread ID. */
|
|
else if (thread_ptr -> tx_thread_id != TX_THREAD_ID)
|
|
{
|
|
|
|
/* Thread pointer is invalid, return appropriate error code. */
|
|
status = TX_THREAD_ERROR;
|
|
}
|
|
else
|
|
{
|
|
|
|
/* Call actual thread delete function. */
|
|
status = _tx_thread_delete(thread_ptr);
|
|
}
|
|
|
|
/* Return completion status. */
|
|
return(status);
|
|
}
|
|
|