diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-12 16:32:27 +0200 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2016-05-20 07:49:37 +0200 |
commit | 9949d8a7d042da7ba53516300db5c34c8b9c8a31 (patch) | |
tree | 614aded79bd69e1134dc1b83711b0636ca8e044d /cpukit/libcsupport/src/privateenv.c | |
parent | score: Delete unused variable (diff) | |
download | rtems-9949d8a7d042da7ba53516300db5c34c8b9c8a31.tar.bz2 |
score: Add Thread_Change_life()
Add _Thread_Change_life_locked() as a general function to alter the
thread life state. Use it to implement _Thread_Set_life_protection() as
a first step.
Update #2555.
Update #2626.
Diffstat (limited to 'cpukit/libcsupport/src/privateenv.c')
-rw-r--r-- | cpukit/libcsupport/src/privateenv.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/cpukit/libcsupport/src/privateenv.c b/cpukit/libcsupport/src/privateenv.c index 29821e4045..bf6036a1b3 100644 --- a/cpukit/libcsupport/src/privateenv.c +++ b/cpukit/libcsupport/src/privateenv.c @@ -57,7 +57,8 @@ rtems_status_code rtems_libio_set_private_env(void) bool uses_global_env = old_env == &rtems_global_user_env; if (uses_global_env) { - bool life_protection = _Thread_Set_life_protection(true); + Thread_Life_state life_state = + _Thread_Set_life_protection(THREAD_LIFE_PROTECTED); rtems_user_env_t *new_env = calloc(1, sizeof(*new_env)); if (new_env != NULL) { @@ -92,7 +93,7 @@ rtems_status_code rtems_libio_set_private_env(void) sc = RTEMS_NO_MEMORY; } - _Thread_Set_life_protection(life_protection); + _Thread_Set_life_protection(life_state); } return sc; @@ -104,11 +105,12 @@ void rtems_libio_use_global_env(void) bool uses_private_env = env != &rtems_global_user_env; if (uses_private_env) { - bool life_protection = _Thread_Set_life_protection(true); + Thread_Life_state life_state = + _Thread_Set_life_protection(THREAD_LIFE_PROTECTED); rtems_libio_free_user_env(env); pthread_setspecific(rtems_current_user_env_key, NULL); - _Thread_Set_life_protection(life_protection); + _Thread_Set_life_protection(life_state); } } |