#include "src/internal_config.h"
#include "xbt/xbt_os_time.h" /* Portable time facilities */
#include "xbt/xbt_os_thread.h" /* This module */
#include "src/internal_config.h"
#include "xbt/xbt_os_time.h" /* Portable time facilities */
#include "xbt/xbt_os_thread.h" /* This module */
main_thread->name = (char *) "main";
main_thread->param = NULL;
main_thread->start_routine = NULL;
main_thread->name = (char *) "main";
main_thread->param = NULL;
main_thread->start_routine = NULL;
if ((errcode = pthread_setspecific(xbt_self_thread_key, main_thread)))
THROWF(system_error, errcode,
"Impossible to set the SimGrid identity descriptor to the main thread (pthread_setspecific failed)");
if ((errcode = pthread_setspecific(xbt_self_thread_key, main_thread)))
THROWF(system_error, errcode,
"Impossible to set the SimGrid identity descriptor to the main thread (pthread_setspecific failed)");
// if ((errcode=pthread_key_delete(xbt_self_thread_key)))
// THROWF(system_error,errcode,"pthread_key_delete failed for xbt_self_thread_key");
// if ((errcode=pthread_key_delete(xbt_self_thread_key)))
// THROWF(system_error,errcode,"pthread_key_delete failed for xbt_self_thread_key");
xbt_os_thread_t xbt_os_thread_create(const char *name, pvoid_f_pvoid_t start_routine, void *param, void *extra_data)
{
xbt_os_thread_t res_thread = xbt_new(s_xbt_os_thread_t, 1);
xbt_os_thread_t xbt_os_thread_create(const char *name, pvoid_f_pvoid_t start_routine, void *param, void *extra_data)
{
xbt_os_thread_t res_thread = xbt_new(s_xbt_os_thread_t, 1);
res_thread->name = xbt_strdup(name);
res_thread->start_routine = start_routine;
res_thread->param = param;
res_thread->name = xbt_strdup(name);
res_thread->start_routine = start_routine;
res_thread->param = param;
res_thread->extra_data = extra_data;
int errcode = pthread_create(&(res_thread->t), &thread_attr, wrapper_start_routine, res_thread);
res_thread->extra_data = extra_data;
int errcode = pthread_create(&(res_thread->t), &thread_attr, wrapper_start_routine, res_thread);
int errcode = pthread_setspecific(key, value);
xbt_assert(errcode==0, "pthread_setspecific failed");
}
int errcode = pthread_setspecific(key, value);
xbt_assert(errcode==0, "pthread_setspecific failed");
}
- THROWF(system_error, errno, "sem_destroy() failed: %s",
- strerror(errno));
+ THROWF(system_error, errno, "sem_destroy() failed: %s", strerror(errno));
#else
if (sem_close(sem->ps) < 0)
THROWF(system_error, errno, "sem_close() failed: %s", strerror(errno));
xbt_free(sem->name);
#else
if (sem_close(sem->ps) < 0)
THROWF(system_error, errno, "sem_close() failed: %s", strerror(errno));
xbt_free(sem->name);