source: rtems/cpukit/posix/src/condsignalsupp.c @ 8f96581

5
Last change on this file since 8f96581 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.7 KB
Line 
1/**
2 * @file
3 *
4 * @brief Implements wake up version of the "signal" operation
5 * @ingroup POSIX_COND_VARS Condition Variables
6 */
7
8/*
9 *  COPYRIGHT (c) 1989-2014.
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 <pthread.h>
22#include <errno.h>
23
24#include <rtems/system.h>
25#include <rtems/score/watchdog.h>
26#include <rtems/posix/condimpl.h>
27#include <rtems/posix/muteximpl.h>
28
29/*
30 *  _POSIX_Condition_variables_Signal_support
31 *
32 *  A support routine which implements guts of the broadcast and single task
33 *  wake up version of the "signal" operation.
34 */
35
36int _POSIX_Condition_variables_Signal_support(
37  pthread_cond_t            *cond,
38  bool                       is_broadcast
39)
40{
41  POSIX_Condition_variables_Control          *the_cond;
42  Objects_Locations                           location;
43  Thread_Control                             *the_thread;
44
45  the_cond = _POSIX_Condition_variables_Get( cond, &location );
46  switch ( location ) {
47
48    case OBJECTS_LOCAL:
49      do {
50        the_thread = _Thread_queue_Dequeue(
51          &the_cond->Wait_queue,
52          POSIX_CONDITION_VARIABLES_TQ_OPERATIONS,
53          NULL,
54          0
55        );
56        if ( !the_thread )
57          the_cond->Mutex = POSIX_CONDITION_VARIABLES_NO_MUTEX;
58      } while ( is_broadcast && the_thread );
59
60      _Objects_Put( &the_cond->Object );
61
62      return 0;
63
64#if defined(RTEMS_MULTIPROCESSING)
65    case OBJECTS_REMOTE:
66#endif
67    case OBJECTS_ERROR:
68      break;
69  }
70
71  return EINVAL;
72}
Note: See TracBrowser for help on using the repository browser.