source: rtems/cpukit/posix/src/pthreadexit.c @ ed24ed4e

5
Last change on this file since ed24ed4e was ed24ed4e, checked in by Sebastian Huber <sebastian.huber@…>, on Feb 8, 2018 at 9:47:16 AM

Use _Thread_Dispatch_direct()

Use _Thread_Dispatch_direct() for operations that block the executing
thread. This ensures that we get a fatal error
(INTERNAL_ERROR_BAD_THREAD_DISPATCH_DISABLE_LEVEL) if we try to block in
an invalid context, e.g. during system start or an interrupt handler.

  • Property mode set to 100644
File size: 835 bytes
Line 
1/**
2 * @file
3 *
4 * @brief POSIX Thread Exit Shared Helper
5 * @ingroup POSIX_THREAD Thread API Extension
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2011.
10 *  On-Line Applications Research Corporation (OAR).
11 *
12 *  Copyright (c) 2016 embedded brains GmbH.
13 *
14 *  The license and distribution terms for this file may be
15 *  found in the file LICENSE in this distribution or at
16 *  http://www.rtems.org/license/LICENSE.
17 */
18
19#if HAVE_CONFIG_H
20#include "config.h"
21#endif
22
23#include <pthread.h>
24
25#include <rtems/score/threadimpl.h>
26
27void pthread_exit( void *value_ptr )
28{
29  Thread_Control  *executing;
30  Per_CPU_Control *cpu_self;
31
32  cpu_self = _Thread_Dispatch_disable();
33  executing = _Per_CPU_Get_executing( cpu_self );
34
35  _Thread_Exit( executing, THREAD_LIFE_TERMINATING, value_ptr );
36
37  _Thread_Dispatch_direct( cpu_self );
38  RTEMS_UNREACHABLE();
39}
Note: See TracBrowser for help on using the repository browser.