source: rtems/cpukit/sapi/src/extensiondelete.c @ 599d71f

Last change on this file since 599d71f was 23fec9f, checked in by Sebastian Huber <sebastian.huber@…>, on Mar 27, 2014 at 1:16:12 PM

score: PR2152: Use allocator mutex for objects

Use allocator mutex for objects allocate/free. This prevents that the
thread dispatch latency depends on the workspace/heap fragmentation.

  • Property mode set to 100644
File size: 1.2 KB
Line 
1/**
2 * @file
3 *
4 * @ingroup ClassicUserExtensions
5 *
6 * @brief User Extensions Implementation.
7 */
8
9/*
10 *  COPYRIGHT (c) 1989-2007.
11 *  On-Line Applications Research Corporation (OAR).
12 *
13 *  The license and distribution terms for this file may be
14 *  found in the file LICENSE in this distribution or at
15 *  http://www.rtems.org/license/LICENSE.
16 */
17
18#if HAVE_CONFIG_H
19#include "config.h"
20#endif
21
22#include <rtems/extensionimpl.h>
23#include <rtems/score/thread.h>
24#include <rtems/score/userextimpl.h>
25
26rtems_status_code rtems_extension_delete(
27  rtems_id id
28)
29{
30  Extension_Control   *the_extension;
31  Objects_Locations    location;
32
33  _Objects_Allocator_lock();
34  the_extension = _Extension_Get( id, &location );
35  switch ( location ) {
36    case OBJECTS_LOCAL:
37      _User_extensions_Remove_set( &the_extension->Extension );
38      _Objects_Close( &_Extension_Information, &the_extension->Object );
39      _Objects_Put( &the_extension->Object );
40      _Extension_Free( the_extension );
41      _Objects_Allocator_unlock();
42      return RTEMS_SUCCESSFUL;
43
44#if defined(RTEMS_MULTIPROCESSING)
45    case OBJECTS_REMOTE:            /* should never return this */
46#endif
47    case OBJECTS_ERROR:
48      break;
49  }
50
51  _Objects_Allocator_unlock();
52
53  return RTEMS_INVALID_ID;
54}
Note: See TracBrowser for help on using the repository browser.