diff options
author | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-05-23 16:26:28 -0500 |
---|---|---|
committer | Joel Sherrill <joel.sherrill@oarcorp.com> | 2014-05-23 16:46:49 -0500 |
commit | 718b2b6be887f56aad102be7378dff9947f84039 (patch) | |
tree | 7f4b73dc9f435fbbe5cf84e80d26a7e3bc47a217 | |
parent | fef48827c422b9b519d4357df55f566f8d4d6f5c (diff) |
main_semobtain.c: Locked access to executing
-rw-r--r-- | schedsim/shell/shared/main_semobtain.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/schedsim/shell/shared/main_semobtain.c b/schedsim/shell/shared/main_semobtain.c index 12ae381..d5b4388 100644 --- a/schedsim/shell/shared/main_semobtain.c +++ b/schedsim/shell/shared/main_semobtain.c @@ -21,6 +21,16 @@ #include <schedsim_shell.h> #include <rtems/error.h> +static Thread_Control *get_thread_executing(void) +{ + Thread_Control *e; + + _Thread_Disable_dispatch(); + e = _Thread_Executing; + _Thread_Enable_dispatch(); + return e; +} + int rtems_shell_main_semaphore_obtain( int argc, char *argv[] @@ -58,10 +68,10 @@ int rtems_shell_main_semaphore_obtain( * a thread switch inside the semaphore obtain. If we did, then * just return successfully. */ - caller = _Thread_Executing; + caller = get_thread_executing(); printf("Obtain semaphore (0x%08x) with timeout %d\n", id, ticks ); status = rtems_semaphore_obtain( id, RTEMS_DEFAULT_OPTIONS, ticks ); - if ( caller == _Thread_Executing ) { + if ( caller == get_thread_executing() ) { if ( status != RTEMS_SUCCESSFUL ) { fprintf( stderr, |