GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_system_event_remove.c Lines: 20 20 100.0 %
Date: 2026-03-06 19:21:09 Branches: 12 12 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
/** GUIX Component                                                        */
17
/**                                                                       */
18
/**   System Management (System)                                          */
19
/**                                                                       */
20
/**************************************************************************/
21
22
#define GX_SOURCE_CODE
23
24
25
/* Include necessary system files.  */
26
27
#include "gx_api.h"
28
#include "gx_system.h"
29
#include "gx_widget.h"
30
#include "gx_utility.h"
31
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_system_event_remove                             PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function removes events targetted to indicated widget          */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    remove                                Widget to be removed          */
50
/*                                                                        */
51
/*  OUTPUT                                                                */
52
/*                                                                        */
53
/*    None                                                                */
54
/*                                                                        */
55
/*  CALLS                                                                 */
56
/*                                                                        */
57
/*    _gx_widget_child_detect               Detect a child widget         */
58
/*                                                                        */
59
/*  CALLED BY                                                             */
60
/*                                                                        */
61
/*    _gx_widget_delete                     Delete a widget               */
62
/*                                                                        */
63
/**************************************************************************/
64
331
VOID  _gx_system_event_remove(GX_WIDGET *widget)
65
{
66
#ifdef GX_THREADX_BINDING
67
68
TX_INTERRUPT_SAVE_AREA
69
70
GX_EVENT *pEvent;
71
ULONG    *pSrc;
72
TX_QUEUE *pQueue;
73
GX_BOOL   Purge;
74
75
331
    TX_DISABLE
76
77
331
    pQueue = &_gx_system_event_queue;
78
79
331
    if (pQueue -> tx_queue_enqueued)
80
    {
81
79
        pSrc =  pQueue -> tx_queue_read;
82
83
        do
84
        {
85
2561
            pEvent = (GX_EVENT *)pSrc;
86
2561
            Purge = GX_FALSE;
87
88
2561
            if (pEvent -> gx_event_target)
89
            {
90
2540
                if (pEvent -> gx_event_target == widget)
91
                {
92
53
                    Purge = GX_TRUE;
93
                }
94
                else
95
                {
96
2487
                    _gx_widget_child_detect(widget, pEvent -> gx_event_target, &Purge);
97
                }
98
2540
                if (Purge)
99
                {
100
53
                    pEvent -> gx_event_target = GX_NULL;
101
53
                    pEvent -> gx_event_type = 0;
102
                }
103
            }
104
105
2561
            pSrc += pQueue -> tx_queue_message_size;
106
107
2561
            if (pSrc >= pQueue -> tx_queue_end)
108
            {
109
52
                pSrc = pQueue -> tx_queue_start;
110
            }
111
2561
        } while (pSrc != pQueue->tx_queue_write);
112
    }
113
331
    TX_RESTORE
114
#else
115
    GX_EVENT_PURGE(widget);
116
#endif
117
331
}
118