X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/347b2193ad200d91018ca5be4894a4679fe09e79..2d103e931b4e47eb04613d0d038b08f5c0a2d004:/src/simix/smx_context_sysv.c diff --git a/src/simix/smx_context_sysv.c b/src/simix/smx_context_sysv.c index 568cd0f48e..4d30329226 100644 --- a/src/simix/smx_context_sysv.c +++ b/src/simix/smx_context_sysv.c @@ -68,9 +68,8 @@ void SIMIX_ctx_sysv_factory_init(smx_context_factory_t *factory) parmap = xbt_parmap_new(2); (*factory)->runall = smx_ctx_sysv_runall_parallel; (*factory)->self = smx_ctx_sysv_self_parallel; - (*factory)->get_thread_id = smx_ctx_sysv_get_thread_id; #else - THROW0(arg_error, 0, "No thread support for parallel context execution"); + THROWF(arg_error, 0, "No thread support for parallel context execution"); #endif }else{ (*factory)->runall = smx_ctx_sysv_runall; @@ -107,7 +106,7 @@ smx_ctx_sysv_create_context_sized(size_t size, xbt_main_func_t code, int res; res = getcontext(&(context->uc)); - xbt_assert2(res == 0, + xbt_assert(res == 0, "Error in context saving: %d (%s)", errno, strerror(errno)); @@ -190,20 +189,20 @@ void smx_ctx_sysv_wrapper(int first, ...) void smx_ctx_sysv_suspend(smx_context_t context) { - smx_current_context = (smx_context_t)maestro_context; + SIMIX_context_set_current((smx_context_t) maestro_context); int rv; rv = swapcontext(&((smx_ctx_sysv_t) context)->uc, &((smx_ctx_sysv_t)context)->old_uc); - xbt_assert0((rv == 0), "Context swapping failure"); + xbt_assert((rv == 0), "Context swapping failure"); } void smx_ctx_sysv_resume(smx_context_t context) { - smx_current_context = context; + SIMIX_context_set_current(context); int rv; rv = swapcontext(&((smx_ctx_sysv_t)context)->old_uc, &((smx_ctx_sysv_t) context)->uc); - xbt_assert0((rv == 0), "Context swapping failure"); + xbt_assert((rv == 0), "Context swapping failure"); } void smx_ctx_sysv_runall(xbt_dynar_t processes) @@ -215,18 +214,17 @@ void smx_ctx_sysv_runall(xbt_dynar_t processes) XBT_DEBUG("Schedule item %u of %lu",cursor,xbt_dynar_length(processes)); smx_ctx_sysv_resume(process->context); } - xbt_dynar_reset(processes); } void smx_ctx_sysv_resume_parallel(smx_process_t process) { smx_context_t context = process->context; - smx_current_context = (smx_context_t)context; + SIMIX_context_set_current((smx_context_t) context); int rv; rv = swapcontext(&((smx_ctx_sysv_t)context)->old_uc, &((smx_ctx_sysv_t) context)->uc); - smx_current_context = (smx_context_t)maestro_context; + SIMIX_context_set_current((smx_context_t) maestro_context); - xbt_assert0((rv == 0), "Context swapping failure"); + xbt_assert((rv == 0), "Context swapping failure"); } void smx_ctx_sysv_runall_parallel(xbt_dynar_t processes) @@ -234,17 +232,11 @@ void smx_ctx_sysv_runall_parallel(xbt_dynar_t processes) #ifdef CONTEXT_THREADS xbt_parmap_apply(parmap, (void_f_pvoid_t)smx_ctx_sysv_resume_parallel, processes); #endif - xbt_dynar_reset(processes); } smx_context_t smx_ctx_sysv_self_parallel(void) { /*smx_context_t self_context = (smx_context_t) xbt_os_thread_get_extra_data(); return self_context ? self_context : (smx_context_t) maestro_context;*/ - return smx_current_context; -} - -int smx_ctx_sysv_get_thread_id(void) -{ - return (int)(unsigned long)xbt_os_thread_get_extra_data(); + return SIMIX_context_get_current(); }