5
Last change
on this file since 2548d14 was
d7a12be9,
checked in by Sebastian Huber <sebastian.huber@…>, on 04/19/16 at 12:14:10
|
score: Optimize _Objects_Get_no_protection()
Make the id the first parameter since usual callers get the object
identifier as the first parameter themself.
|
-
Property mode set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /** |
---|
2 | * @file |
---|
3 | * |
---|
4 | * @brief Get Pointer to Next Object that is Active |
---|
5 | * @ingroup ScoreObject |
---|
6 | */ |
---|
7 | |
---|
8 | /* |
---|
9 | * COPYRIGHT (c) 1989-1999. |
---|
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/objectimpl.h> |
---|
22 | |
---|
23 | Objects_Control *_Objects_Get_next( |
---|
24 | Objects_Id id, |
---|
25 | const Objects_Information *information, |
---|
26 | Objects_Id *next_id_p |
---|
27 | ) |
---|
28 | { |
---|
29 | Objects_Control *the_object; |
---|
30 | Objects_Id next_id; |
---|
31 | |
---|
32 | if ( !information ) |
---|
33 | return NULL; |
---|
34 | |
---|
35 | if ( !next_id_p ) |
---|
36 | return NULL; |
---|
37 | |
---|
38 | if (_Objects_Get_index(id) == OBJECTS_ID_INITIAL_INDEX) |
---|
39 | next_id = information->minimum_id; |
---|
40 | else |
---|
41 | next_id = id; |
---|
42 | |
---|
43 | _Objects_Allocator_lock(); |
---|
44 | |
---|
45 | do { |
---|
46 | /* walked off end of list? */ |
---|
47 | if (_Objects_Get_index(next_id) > information->maximum) |
---|
48 | { |
---|
49 | _Objects_Allocator_unlock(); |
---|
50 | *next_id_p = OBJECTS_ID_FINAL; |
---|
51 | return NULL; |
---|
52 | } |
---|
53 | |
---|
54 | /* try to grab one */ |
---|
55 | the_object = _Objects_Get_no_protection( next_id, information ); |
---|
56 | |
---|
57 | next_id++; |
---|
58 | |
---|
59 | } while ( the_object == NULL ); |
---|
60 | |
---|
61 | *next_id_p = next_id; |
---|
62 | return the_object; |
---|
63 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.