/** @defgroup XBT_graph General purpose graph library */
/** @defgroup XBT_parmap Parallel map */
/** @defgroup XBT_synchro Simulated Synchronization */
- /** @defgroup XBT_thread Thread stuff */
/** @defgroup XBT_context Portable context implementation */
/** @defgroup XBT_replay Replay */
/** @} */
#endif
#include <xbt/cunit.h>
-#include <xbt/xbt_os_thread.h>
#include <xbt/xbt_os_time.h>
#endif /* XBT_H */
+++ /dev/null
-/* xbt/xbt_os_thread.h -- Thread portability layer */
-
-/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#ifndef XBT_OS_THREAD_H
-#define XBT_OS_THREAD_H
-
-#include <xbt/base.h>
-#include <xbt/function_types.h>
-
-SG_BEGIN_DECL()
-
-/** @addtogroup XBT_thread
- * @brief Thread portability layer
- *
- * This section describes the thread portability layer. It defines types and functions very close to the pthread API,
- * but it's portable to windows too.
- *
- * @{
- */
-
-/** @brief Thread mutex data type (opaque structure) */
-typedef struct xbt_os_mutex_ *xbt_os_mutex_t;
-XBT_PUBLIC xbt_os_mutex_t xbt_os_mutex_init(void);
-XBT_PUBLIC void xbt_os_mutex_acquire(xbt_os_mutex_t mutex);
-XBT_PUBLIC void xbt_os_mutex_release(xbt_os_mutex_t mutex);
-XBT_PUBLIC void xbt_os_mutex_destroy(xbt_os_mutex_t mutex);
-
-/** @} */
-
-SG_END_DECL()
-#endif /* XBT_OS_THREAD_H */
#include "simgrid/simix.h"
#include "src/kernel/context/ContextThread.hpp"
#include "src/simix/smx_private.hpp"
-#include "xbt/xbt_os_thread.h"
#include "jmsg.hpp"
#include "src/internal_config.h" // HAVE_FUTEX_H
#include "src/kernel/context/Context.hpp"
-#include "xbt/xbt_os_thread.h"
#include <boost/optional.hpp>
#include <condition_variable>
#include <simgrid/simix.hpp>
#include <xbt/parmap.hpp>
-#include <xbt/xbt_os_thread.h>
#include "src/internal_config.h"
#include "src/kernel/context/Context.hpp"
#include <vector>
#include <xbt/parmap.hpp>
-#include <xbt/xbt_os_thread.h>
#include "src/kernel/context/ContextSwapped.hpp"
#include "src/simix/smx_private.hpp"
#include "src/xbt_modinter.h" /* prototype of os thread module's init/exit in XBT */
#include "xbt/function_types.h"
-#include "xbt/xbt_os_thread.h"
#include <functional>
#include <utility>
#include "simgrid/simix.hpp"
#include "src/kernel/context/Context.hpp"
#include "src/xbt/OsSemaphore.hpp"
-#include "xbt/xbt_os_thread.h"
#include <thread>
#include <simgrid/simix.hpp>
#include <xbt/parmap.hpp>
-#include <xbt/xbt_os_thread.h>
#include "src/internal_config.h"
#include "src/kernel/context/ContextSwapped.hpp"
+++ /dev/null
-/* xbt_os_thread -- portability layer over the pthread API */
-/* Used in RL to get win/lin portability, and in SG when CONTEXT_THREAD */
-/* in SG, when using HAVE_UCONTEXT_CONTEXTS, xbt_os_thread_stub is used instead */
-
-/* Copyright (c) 2007-2019. The SimGrid Team. All rights reserved. */
-
-/* This program is free software; you can redistribute it and/or modify it
- * under the terms of the license (GNU LGPL) which comes with this package. */
-
-#include "src/internal_config.h"
-#if HAVE_PTHREAD_SETAFFINITY
-#define _GNU_SOURCE
-#include <sched.h>
-#endif
-
-#include <pthread.h>
-
-#include <limits.h>
-#include <semaphore.h>
-#include <errno.h>
-
-#if defined(_WIN32)
-#include <windows.h>
-#elif defined(__MACH__) && defined(__APPLE__)
-#include <stdint.h>
-#include <sys/types.h>
-#include <sys/sysctl.h>
-#else
-#include <unistd.h>
-#endif
-
-#include "xbt/sysdep.h"
-#include "xbt/ex.h"
-#include "src/internal_config.h"
-#include "xbt/xbt_os_time.h" /* Portable time facilities */
-#include "xbt/xbt_os_thread.h" /* This module */
-#include "src/xbt_modinter.h" /* Initialization/finalization of this module */
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync_os, xbt, "Synchronization mechanism (OS-level)");
-
-/****** mutex related functions ******/
-typedef struct xbt_os_mutex_ {
- pthread_mutex_t m;
-} s_xbt_os_mutex_t;
-
-#include <time.h>
-#include <math.h>
-
-xbt_os_mutex_t xbt_os_mutex_init(void)
-{
- pthread_mutexattr_t Attr;
- pthread_mutexattr_init(&Attr);
- pthread_mutexattr_settype(&Attr, PTHREAD_MUTEX_RECURSIVE);
-
- xbt_os_mutex_t res = xbt_new(s_xbt_os_mutex_t, 1);
- int errcode = pthread_mutex_init(&(res->m), &Attr);
- xbt_assert(errcode==0, "pthread_mutex_init() failed: %s", strerror(errcode));
-
- return res;
-}
-
-void xbt_os_mutex_acquire(xbt_os_mutex_t mutex)
-{
- int errcode = pthread_mutex_lock(&(mutex->m));
- xbt_assert(errcode==0, "pthread_mutex_lock(%p) failed: %s", mutex, strerror(errcode));
-}
-
-void xbt_os_mutex_release(xbt_os_mutex_t mutex)
-{
- int errcode = pthread_mutex_unlock(&(mutex->m));
- xbt_assert(errcode==0, "pthread_mutex_unlock(%p) failed: %s", mutex, strerror(errcode));
-}
-
-void xbt_os_mutex_destroy(xbt_os_mutex_t mutex)
-{
- if (!mutex)
- return;
-
- int errcode = pthread_mutex_destroy(&(mutex->m));
- xbt_assert(errcode == 0, "pthread_mutex_destroy(%p) failed: %s", mutex, strerror(errcode));
- free(mutex);
-}
src/xbt/xbt_main.cpp
src/xbt/xbt_os_file.cpp
src/xbt/xbt_os_synchro.cpp
- src/xbt/xbt_os_thread.c
src/xbt/xbt_os_time.c
src/xbt/xbt_replay.cpp
src/xbt/xbt_str.cpp
include/xbt/system_error.hpp
include/xbt/utility.hpp
include/xbt/virtu.h
- include/xbt/xbt_os_thread.h
include/xbt/xbt_os_time.h
)
set(source_of_generated_headers
src/xbt/dict.cpp src/xbt/dict_elm.c src/xbt/dict_cursor.c
src/xbt/dynar.cpp
src/xbt/xbt_str.cpp src/xbt/snprintf.c
- src/xbt/xbt_os_time.c src/xbt/xbt_os_thread.c
+ src/xbt/xbt_os_time.c
src/xbt/backtrace_linux.cpp
${MC_SRC_BASE} ${MC_SRC})
set (mcCFLAGS "-O3 -funroll-loops -fno-strict-aliasing")