From 9949d8a7d042da7ba53516300db5c34c8b9c8a31 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 12 May 2016 16:32:27 +0200 Subject: 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. --- cpukit/libcsupport/src/privateenv.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'cpukit/libcsupport/src/privateenv.c') 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); } } -- cgit v1.2.3