From df49c60c9671e4a28e636964d744c1f59fb6cb68 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 12 Jun 2000 15:00:15 +0000 Subject: Merged from 4.5.0-beta3a --- c/src/exec/rtems/src/Makefile.am | 5 ++--- c/src/exec/rtems/src/semdelete.c | 37 +++++++++++++++---------------- c/src/exec/rtems/src/tasks.c | 8 +++++-- c/src/exec/rtems/src/taskvariableadd.c | 2 +- c/src/exec/rtems/src/taskvariabledelete.c | 2 ++ c/src/exec/rtems/src/taskvariableget.c | 2 +- 6 files changed, 30 insertions(+), 26 deletions(-) (limited to 'c/src/exec/rtems/src') diff --git a/c/src/exec/rtems/src/Makefile.am b/c/src/exec/rtems/src/Makefile.am index 16d932dc9d..f597292be1 100644 --- a/c/src/exec/rtems/src/Makefile.am +++ b/c/src/exec/rtems/src/Makefile.am @@ -42,7 +42,7 @@ SIGNAL_C_FILES = signal.c signalcatch.c signalsend.c REGION_C_FILES = region.c regioncreate.c regiondelete.c regionextend.c \ regiongetsegment.c regiongetsegmentsize.c regionident.c \ - regionreturnsegment.c regionreturnsegment.c + regionreturnsegment.c PARTITION_C_FILES = part.c partcreate.c partdelete.c partgetbuffer.c \ partident.c partreturnbuffer.c @@ -70,9 +70,8 @@ OBJS = $(C_O_FILES) # AM_CPPFLAGS += -D__RTEMS_INSIDE__ -AM_CFLAGS += $(CFLAGS_OS_V) -all: ${ARCH} ${OBJS} +all-local: ${ARCH} ${OBJS} EXTRA_DIST = $(STD_C_FILES) $(MP_C_FILES) diff --git a/c/src/exec/rtems/src/semdelete.c b/c/src/exec/rtems/src/semdelete.c index 1e9b165c71..079d9ed810 100644 --- a/c/src/exec/rtems/src/semdelete.c +++ b/c/src/exec/rtems/src/semdelete.c @@ -61,6 +61,12 @@ * error code - if unsuccessful */ +#if defined(RTEMS_MULTIPROCESSING) +#define SEMAPHORE_MP_OBJECT_WAS_DELETED _Semaphore_MP_Send_object_was_deleted +#else +#define SEMAPHORE_MP_OBJECT_WAS_DELETED NULL +#endif + rtems_status_code rtems_semaphore_delete( Objects_Id id ) @@ -81,32 +87,25 @@ rtems_status_code rtems_semaphore_delete( return RTEMS_INVALID_ID; case OBJECTS_LOCAL: - if ( !_Attributes_Is_counting_semaphore(the_semaphore->attribute_set) ) { - if ( _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex ) ) { + if ( !_Attributes_Is_counting_semaphore(the_semaphore->attribute_set) ) { + if ( _CORE_mutex_Is_locked( &the_semaphore->Core_control.mutex ) && + !_Attributes_Is_simple_binary_semaphore( + the_semaphore->attribute_set ) ) { _Thread_Enable_dispatch(); return RTEMS_RESOURCE_IN_USE; } - else - _CORE_mutex_Flush( - &the_semaphore->Core_control.mutex, -#if defined(RTEMS_MULTIPROCESSING) - _Semaphore_MP_Send_object_was_deleted, -#else - NULL, -#endif - CORE_MUTEX_WAS_DELETED - ); - } - else + _CORE_mutex_Flush( + &the_semaphore->Core_control.mutex, + SEMAPHORE_MP_OBJECT_WAS_DELETED, + CORE_MUTEX_WAS_DELETED + ); + } else { _CORE_semaphore_Flush( &the_semaphore->Core_control.semaphore, -#if defined(RTEMS_MULTIPROCESSING) - _Semaphore_MP_Send_object_was_deleted, -#else - NULL, -#endif + SEMAPHORE_MP_OBJECT_WAS_DELETED, CORE_SEMAPHORE_WAS_DELETED ); + } _Objects_Close( &_Semaphore_Information, &the_semaphore->Object ); diff --git a/c/src/exec/rtems/src/tasks.c b/c/src/exec/rtems/src/tasks.c index 5fdff2db18..40426642c9 100644 --- a/c/src/exec/rtems/src/tasks.c +++ b/c/src/exec/rtems/src/tasks.c @@ -105,6 +105,8 @@ User_extensions_routine _RTEMS_tasks_Delete_extension( next = tvp->next; if (tvp->dtor) (*tvp->dtor)( tvp->ptr ); + if (executing == deleted) + *tvp->ptr = tvp->gval; _Workspace_Free( tvp ); tvp = next; } @@ -137,13 +139,15 @@ void _RTEMS_tasks_Switch_extension( tvp = executing->task_variables; while (tvp) { - tvp->var = *tvp->ptr; + tvp->tval = *tvp->ptr; + *tvp->ptr = tvp->gval; tvp = tvp->next; } tvp = heir->task_variables; while (tvp) { - *tvp->ptr = tvp->var; + tvp->gval = *tvp->ptr; + *tvp->ptr = tvp->tval; tvp = tvp->next; } } diff --git a/c/src/exec/rtems/src/taskvariableadd.c b/c/src/exec/rtems/src/taskvariableadd.c index 0f1ae0895e..04d56d409d 100644 --- a/c/src/exec/rtems/src/taskvariableadd.c +++ b/c/src/exec/rtems/src/taskvariableadd.c @@ -72,7 +72,7 @@ rtems_status_code rtems_task_variable_add( _Thread_Enable_dispatch(); return RTEMS_NO_MEMORY; } - new->var = 0; + new->gval = *ptr; new->ptr = ptr; new->dtor = dtor; diff --git a/c/src/exec/rtems/src/taskvariabledelete.c b/c/src/exec/rtems/src/taskvariabledelete.c index c760f9ba39..d87a772c18 100644 --- a/c/src/exec/rtems/src/taskvariabledelete.c +++ b/c/src/exec/rtems/src/taskvariabledelete.c @@ -53,6 +53,8 @@ rtems_status_code rtems_task_variable_delete( if (tvp->ptr == ptr) { if (prev) prev->next = tvp->next; else the_thread->task_variables = tvp->next; + if (_Thread_Is_executing (the_thread)) + *tvp->ptr = tvp->gval; _Thread_Enable_dispatch(); _Workspace_Free(tvp); return RTEMS_SUCCESSFUL; diff --git a/c/src/exec/rtems/src/taskvariableget.c b/c/src/exec/rtems/src/taskvariableget.c index 9beb0c4045..cc6e98045c 100644 --- a/c/src/exec/rtems/src/taskvariableget.c +++ b/c/src/exec/rtems/src/taskvariableget.c @@ -59,7 +59,7 @@ rtems_status_code rtems_task_variable_get( * Should this return the current (i.e not the * saved) value if `tid' is the current task? */ - *result = tvp->var; + *result = tvp->tval; _Thread_Enable_dispatch(); return RTEMS_SUCCESSFUL; } -- cgit v1.2.3