source: rtems/cpukit/score/src/corebarrierwait.c @ 0a97ba5b

5
Last change on this file since 0a97ba5b was 8f96581, checked in by Sebastian Huber <sebastian.huber@…>, on 04/01/16 at 09:38:47

score: Rework MP thread queue callout support

The thread queue implementation was heavily reworked to support SMP.
This broke the multiprocessing support of the thread queues. This is
fixed by this patch.

A thread proxy is unblocked due to three reasons

1) timeout,
2) request satisfaction, and
3) extraction.

In case 1) no MPCI message must be sent. This is ensured via the
_Thread_queue_MP_callout_do_nothing() callout set during
_Thread_MP_Allocate_proxy().

In case 2) and 3) an MPCI message must be sent. In case we interrupt
the blocking operation during _Thread_queue_Enqueue_critical(), then
this message must be sent by the blocking thread. For this the new
fields Thread_Proxy_control::thread_queue_callout and
Thread_Proxy_control::thread_queue_id are used.

Delete the individual API MP callout types and use
Thread_queue_MP_callout throughout. This type is only defined in
multiprocessing configurations. Prefix the multiprocessing parameters
with mp_ to ease code review. Multiprocessing specific parameters are
optional due to use of a similar macro pattern. There is no overhead
for non-multiprocessing configurations.

  • Property mode set to 100644
File size: 1.6 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief Wait For The Barrier
5 *  @ingroup ScoreBarrier
6 */
7
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#if HAVE_CONFIG_H
18#include "config.h"
19#endif
20
21#include <rtems/score/corebarrierimpl.h>
22#include <rtems/score/isrlevel.h>
23#include <rtems/score/statesimpl.h>
24#include <rtems/score/threadqimpl.h>
25
26void _CORE_barrier_Do_wait(
27  CORE_barrier_Control    *the_barrier,
28  Thread_Control          *executing,
29  bool                     wait,
30  Watchdog_Interval        timeout
31#if defined(RTEMS_MULTIPROCESSING)
32  ,
33  Thread_queue_MP_callout  mp_callout,
34  Objects_Id               mp_id
35#endif
36)
37{
38  ISR_lock_Context lock_context;
39
40  executing->Wait.return_code = CORE_BARRIER_STATUS_SUCCESSFUL;
41  _Thread_queue_Acquire( &the_barrier->Wait_queue, &lock_context );
42  the_barrier->number_of_waiting_threads++;
43  if ( _CORE_barrier_Is_automatic( &the_barrier->Attributes ) ) {
44    if ( the_barrier->number_of_waiting_threads ==
45         the_barrier->Attributes.maximum_count) {
46      executing->Wait.return_code = CORE_BARRIER_STATUS_AUTOMATICALLY_RELEASED;
47      _Thread_queue_Release( &the_barrier->Wait_queue, &lock_context );
48      _CORE_barrier_Release( the_barrier, mp_callout, mp_id );
49      return;
50    }
51  }
52
53  _Thread_queue_Enqueue_critical(
54    &the_barrier->Wait_queue.Queue,
55    CORE_BARRIER_TQ_OPERATIONS,
56    executing,
57    STATES_WAITING_FOR_BARRIER,
58    timeout,
59    CORE_BARRIER_TIMEOUT,
60    &lock_context
61  );
62}
Note: See TracBrowser for help on using the repository browser.