source: rtems/cpukit/rtems/src/semflush.c @ 9809d6e0

5
Last change on this file since 9809d6e0 was 9809d6e0, checked in by Sebastian Huber <sebastian.huber@…>, on 03/30/16 at 09:39:58

score: _Thread_queue_Flush() parameter changes

Change _Thread_queue_Flush() into a macro that invokes
_Thread_queue_Do_flush() with the parameter set defined by
RTEMS_MULTIPROCESSING. For multiprocessing configurations add the
object identifier to avoid direct use of the thread wait information.

Use mp_ prefix for multiprocessing related parameters.

Rename Thread_queue_Flush_callout to Thread_queue_MP_callout since this
type will be re-used later for other operations as well.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/**
2 *  @file
3 *
4 *  @brief RTEMS Semaphore Flush
5 *  @ingroup ClassicSem
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 <rtems/system.h>
22#include <rtems/rtems/status.h>
23#include <rtems/rtems/support.h>
24#include <rtems/rtems/attrimpl.h>
25#include <rtems/score/isr.h>
26#include <rtems/rtems/options.h>
27#include <rtems/rtems/semimpl.h>
28#include <rtems/score/coremuteximpl.h>
29#include <rtems/score/coresemimpl.h>
30#include <rtems/score/thread.h>
31
32#include <rtems/score/interr.h>
33
34rtems_status_code rtems_semaphore_flush(
35  rtems_id        id
36)
37{
38  Semaphore_Control          *the_semaphore;
39  Objects_Locations           location;
40  rtems_attribute             attribute_set;
41
42  the_semaphore = _Semaphore_Get( id, &location );
43  switch ( location ) {
44
45    case OBJECTS_LOCAL:
46      attribute_set = the_semaphore->attribute_set;
47#if defined(RTEMS_SMP)
48      if ( _Attributes_Is_multiprocessor_resource_sharing( attribute_set ) ) {
49        _Objects_Put( &the_semaphore->Object );
50        return RTEMS_NOT_DEFINED;
51      } else
52#endif
53      if ( !_Attributes_Is_counting_semaphore( attribute_set ) ) {
54        _CORE_mutex_Flush(
55          &the_semaphore->Core_control.mutex,
56          CORE_MUTEX_STATUS_UNSATISFIED_NOWAIT,
57          _Semaphore_MP_Send_object_was_deleted,
58          id
59        );
60      } else {
61        _CORE_semaphore_Flush(
62          &the_semaphore->Core_control.semaphore,
63          CORE_SEMAPHORE_STATUS_UNSATISFIED_NOWAIT,
64          _Semaphore_MP_Send_object_was_deleted,
65          id
66        );
67      }
68      _Objects_Put( &the_semaphore->Object );
69      return RTEMS_SUCCESSFUL;
70
71#if defined(RTEMS_MULTIPROCESSING)
72    case OBJECTS_REMOTE:
73      _Thread_Dispatch();
74      return RTEMS_ILLEGAL_ON_REMOTE_OBJECT;
75#endif
76
77    case OBJECTS_ERROR:
78      break;
79  }
80
81  return RTEMS_INVALID_ID;
82}
Note: See TracBrowser for help on using the repository browser.