diff options
Diffstat (limited to 'c/src/exec/score/src/threadget.c')
-rw-r--r-- | c/src/exec/score/src/threadget.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/c/src/exec/score/src/threadget.c b/c/src/exec/score/src/threadget.c index cf0cfaffd2..c8747f76fa 100644 --- a/c/src/exec/score/src/threadget.c +++ b/c/src/exec/score/src/threadget.c @@ -43,30 +43,41 @@ Thread_Control *_Thread_Get ( Objects_Locations *location ) { - Objects_Classes the_class; + unsigned32 the_api; + unsigned32 the_class; Objects_Information *information; + Thread_Control *tp = (Thread_Control *) 0; if ( _Objects_Are_ids_equal( id, OBJECTS_ID_OF_SELF ) ) { _Thread_Disable_dispatch(); *location = OBJECTS_LOCAL; - return( _Thread_Executing ); + tp = _Thread_Executing; + goto done; } + the_api = _Objects_Get_API( id ); + if ( the_api && the_api > OBJECTS_APIS_LAST ) { + *location = OBJECTS_ERROR; + goto done; + } + the_class = _Objects_Get_class( id ); - - if ( the_class > OBJECTS_CLASSES_LAST ) { + if ( the_class != 1 ) { /* threads are always first class :) */ *location = OBJECTS_ERROR; - return (Thread_Control *) 0; - } + goto done; + } - information = _Objects_Information_table[ the_class ]; + information = _Objects_Information_table[ the_api ][ the_class ]; - if ( !information || !information->is_thread ) { + if ( !information ) { *location = OBJECTS_ERROR; - return (Thread_Control *) 0; + goto done; } - return (Thread_Control *) _Objects_Get( information, id, location ); + tp = (Thread_Control *) _Objects_Get( information, id, location ); + +done: + return tp; } #endif |