source: rtems/cpukit/score/src/debugisthreaddispatchingallowed.c @ ab02824

Last change on this file since ab02824 was ab02824, checked in by Joel Sherrill <joel@…>, on 02/16/22 at 21:09:06

score/src/[a-m]*.c: Change license to BSD-2

Updates #3053.

  • Property mode set to 100644
File size: 2.1 KB
Line 
1/* SPDX-License-Identifier: BSD-2-Clause */
2
3/**
4 * @file
5 *
6 * @ingroup RTEMSScore
7 *
8 * @brief This source file contains the implementation of
9 *   _Debug_Is_thread_dispatching_allowed().
10 */
11/*
12 * Copyright (c) 2013-2014 embedded brains GmbH.  All rights reserved.
13 *
14 *  embedded brains GmbH
15 *  Dornierstr. 4
16 *  82178 Puchheim
17 *  Germany
18 *  <rtems@embedded-brains.de>
19 *
20 * Redistribution and use in source and binary forms, with or without
21 * modification, are permitted provided that the following conditions
22 * are met:
23 * 1. Redistributions of source code must retain the above copyright
24 *    notice, this list of conditions and the following disclaimer.
25 * 2. Redistributions in binary form must reproduce the above copyright
26 *    notice, this list of conditions and the following disclaimer in the
27 *    documentation and/or other materials provided with the distribution.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
30 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
33 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
34 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
35 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
36 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
37 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
38 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
39 * POSSIBILITY OF SUCH DAMAGE.
40 */
41
42#ifdef HAVE_CONFIG_H
43#include "config.h"
44#endif
45
46#include <rtems/score/assert.h>
47#include <rtems/score/threaddispatch.h>
48
49#if defined( RTEMS_DEBUG )
50  bool _Debug_Is_thread_dispatching_allowed( void )
51  {
52    bool dispatch_allowed;
53    ISR_Level level;
54    Per_CPU_Control *cpu_self;
55
56    _ISR_Local_disable( level );
57    cpu_self = _Per_CPU_Get_snapshot();
58    dispatch_allowed = cpu_self->thread_dispatch_disable_level == 0;
59    _ISR_Local_enable( level );
60
61    return dispatch_allowed;
62  }
63#endif
Note: See TracBrowser for help on using the repository browser.