RTEMS
coremutexseize.c
Go to the documentation of this file.
1 
8 /*
9  * COPYRIGHT (c) 1989-2006.
10  * On-Line Applications Research Corporation (OAR).
11  *
12  * The license and distribution terms for this file may be
13  * found in the file LICENSE in this distribution or at
14  * http://www.rtems.org/license/LICENSE.
15  */
16 
17 #ifdef HAVE_CONFIG_H
18 #include "config.h"
19 #endif
20 
22 #include <rtems/score/statesimpl.h>
23 #include <rtems/score/thread.h>
24 #include <rtems/score/watchdog.h>
25 
26 Status_Control _CORE_mutex_Seize_slow(
27  CORE_mutex_Control *the_mutex,
28  const Thread_queue_Operations *operations,
29  Thread_Control *executing,
30  bool wait,
31  Thread_queue_Context *queue_context
32 )
33 {
34  if ( wait ) {
36  queue_context,
38  );
40  queue_context,
42  );
44  &the_mutex->Wait_queue.Queue,
45  operations,
46  executing,
47  queue_context
48  );
49  return _Thread_Wait_get_status( executing );
50  } else {
51  _CORE_mutex_Release( the_mutex, queue_context );
52  return STATUS_UNAVAILABLE;
53  }
54 }
CORE Mutex Implementation.
#define STATES_WAITING_FOR_MUTEX
Definition: statesimpl.h:48
Thread_queue_Control Wait_queue
The thread queue of this mutex.
Definition: coremutex.h:62
Thread queue context for the thread queue methods.
Definition: threadq.h:198
static __inline__ void _Thread_queue_Context_set_deadlock_callout(Thread_queue_Context *queue_context, Thread_queue_Deadlock_callout deadlock_callout)
Sets the deadlock callout in the thread queue context.
Definition: threadqimpl.h:324
Constants and Structures Associated with Watchdog Timers.
Thread queue operations.
Definition: threadq.h:517
Thread_queue_Queue Queue
The actual thread queue.
Definition: threadq.h:583
static __inline__ void _Thread_queue_Context_set_thread_state(Thread_queue_Context *queue_context, States_Control thread_state)
Sets the thread state for the thread to enqueue in the thread queue context.
Definition: threadqimpl.h:178
void _Thread_queue_Deadlock_status(Thread_Control *the_thread)
Sets the thread wait return code to STATUS_DEADLOCK.
Inlined Routines Associated with Thread State Information.
static __inline__ void _CORE_mutex_Release(CORE_mutex_Control *the_mutex, Thread_queue_Context *queue_context)
Releases the mutex.
Definition: coremuteximpl.h:85
Control block used to manage each mutex.
Definition: coremutex.h:56
static __inline__ Status_Control _Thread_Wait_get_status(const Thread_Control *the_thread)
Get the status of the wait return code of the thread.
Definition: threadimpl.h:2354
void _Thread_queue_Enqueue(Thread_queue_Queue *queue, const Thread_queue_Operations *operations, Thread_Control *the_thread, Thread_queue_Context *queue_context)
Blocks the thread and places it on the thread queue.
Constants and Structures Related with the Thread Control Block.
Status_Control _CORE_mutex_Seize_slow(CORE_mutex_Control *the_mutex, const Thread_queue_Operations *operations, Thread_Control *executing, bool wait, Thread_queue_Context *queue_context)
Seize the mutex slowly.