GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: core/src/ux_utility_thread_schedule_other.c Lines: 7 7 100.0 %
Date: 2026-03-06 18:57:10 Branches: 2 2 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
10
 **************************************************************************/
11
12
13
/**************************************************************************/
14
/**************************************************************************/
15
/**                                                                       */
16
/** USBX Component                                                        */
17
/**                                                                       */
18
/**   Utility                                                             */
19
/**                                                                       */
20
/**************************************************************************/
21
/**************************************************************************/
22
23
24
/* Include necessary system files.  */
25
26
#define UX_SOURCE_CODE
27
28
#include "ux_api.h"
29
30
31
#if !defined(UX_STANDALONE)
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _ux_utility_thread_schedule_other                   PORTABLE C      */
37
/*                                                           6.1.11       */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Chaoqiong Xiao, Microsoft Corporation                               */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function force the scheduling of all other threads.            */
45
/*                                                                        */
46
/*  INPUT                                                                 */
47
/*                                                                        */
48
/*    caller_priority                        Priority to restore.          */
49
/*                                                                        */
50
/*  OUTPUT                                                                */
51
/*                                                                        */
52
/*    Completion Status                                                   */
53
/*                                                                        */
54
/*  CALLS                                                                 */
55
/*                                                                        */
56
/*    tx_thread_identify                    ThreadX identify              */
57
/*    tx_thread_priority_change             ThreadX priority change       */
58
/*    tx_thread_relinquish                  ThreadX relinquish            */
59
/*                                                                        */
60
/*  CALLED BY                                                             */
61
/*                                                                        */
62
/*    USBX Components                                                     */
63
/*                                                                        */
64
/**************************************************************************/
65
1713
UINT  _ux_utility_thread_schedule_other(UINT caller_priority)
66
{
67
68
UINT        status;
69
UINT        old_priority;
70
UX_THREAD   *my_thread;
71
72
    UX_PARAMETER_NOT_USED(caller_priority);
73
74
    /* Call TX to know my own tread.  */
75
1713
    my_thread = tx_thread_identify();
76
77
    /* Call ThreadX to change thread priority .  */
78
1713
    status =  tx_thread_priority_change(my_thread, _ux_system -> ux_system_thread_lowest_priority, &old_priority);
79
80
    /* Check for error.  */
81
1713
    if (status == TX_SUCCESS)
82
    {
83
84
        /* Wait until all other threads passed into the scheduler. */
85
1712
        _ux_utility_thread_relinquish();
86
87
        /* And now return the priority of the thread to normal.  */
88
1709
        status =  tx_thread_priority_change(my_thread, old_priority, &old_priority);
89
90
    }
91
92
    /* Return completion status.  */
93
1710
    return(status);
94
}
95
#endif