1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** ThreadX Component */
16 /** */
17 /** Thread */
18 /** */
19 /**************************************************************************/
20 /**************************************************************************/
21
22 #define TX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "tx_api.h"
28 #include "tx_thread.h"
29
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _txe_thread_relinquish PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* William E. Lamie, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function checks to make sure a thread is executing before the */
44 /* relinquish is executed. */
45 /* */
46 /* INPUT */
47 /* */
48 /* None */
49 /* */
50 /* OUTPUT */
51 /* */
52 /* None */
53 /* */
54 /* CALLS */
55 /* */
56 /* _tx_thread_relinquish Actual thread relinquish call */
57 /* */
58 /* CALLED BY */
59 /* */
60 /* Application Code */
61 /* */
62 /* RELEASE HISTORY */
63 /* */
64 /* DATE NAME DESCRIPTION */
65 /* */
66 /* 05-19-2020 William E. Lamie Initial Version 6.0 */
67 /* 09-30-2020 Yuxin Zhou Modified comment(s), */
68 /* resulting in version 6.1 */
69 /* */
70 /**************************************************************************/
_txe_thread_relinquish(VOID)71 VOID _txe_thread_relinquish(VOID)
72 {
73
74 TX_THREAD *current_thread;
75
76
77 /* Pickup thread pointer. */
78 TX_THREAD_GET_CURRENT(current_thread)
79
80 /* Make sure a thread is executing. */
81 if (current_thread != TX_NULL)
82 {
83
84 /* Now make sure the call is not from an ISR or Initialization. */
85 if (TX_THREAD_GET_SYSTEM_STATE() == ((ULONG) 0))
86 {
87
88 /* Okay to call the real relinquish function. */
89 _tx_thread_relinquish();
90 }
91 }
92 }
93
94