#include "dce-pthread.h"
#include "dce-signal.h"
#include "dce-unistd.h"
#include "dce-manager.h"
#include "process.h"
#include "utils.h"
#include "dce-cxa.h"
#include "dce-stdio.h"
#include "loader-factory.h"
#include "task-manager.h"
#include "kingsley-alloc.h"
#include "ns3/log.h"
#include "ns3/simulator.h"
#include <errno.h>
#include <signal.h>
#include <list>
Go to the source code of this file.
Classes | |
struct | PthreadStartContext |
Functions | |
static void | CleanupPthreadKeys (void) |
void | dce_exit (int status) |
int | dce_pthread_cancel (pthread_t thread) |
int | dce_pthread_create (pthread_t *thread_handle, const pthread_attr_t *attr, void *(*start_routine)(void *), void *arg) |
int | dce_pthread_detach (pthread_t thread_handle) |
void | dce_pthread_exit (void *arg) |
void * | dce_pthread_getspecific (pthread_key_t key) |
int | dce_pthread_join (pthread_t thread_handle, void **value_ptr) |
int | dce_pthread_key_create (pthread_key_t *key, void(*destructor)(void *)) |
int | dce_pthread_key_delete (pthread_key_t key) |
int | dce_pthread_kill (pthread_t th, int sig) |
int | dce_pthread_once (pthread_once_t *once_control, void(*init_routine)(void)) |
pthread_t | dce_pthread_self (void) |
int | dce_pthread_setspecific (pthread_key_t key, const void *value) |
static bool | IsKeyValid (pthread_key_t key) |
NS_LOG_COMPONENT_DEFINE ("SimuPthread") | |
static pthread_t | PidTidToPthread (uint16_t pid, uint16_t tid) |
static void | pthread_do_start (void *context) |
static void | PthreadTaskSwitch (enum Task::SwitchType type, void *context) |
static uint16_t | PthreadToPid (pthread_t thread_handle) |
static uint16_t | PthreadToTid (pthread_t thread_handle) |
|
static |
Definition at line 47 of file dce-pthread.cc.
References ns3::Current(), and ns3::Thread::keyValues.
Referenced by dce_exit(), and dce_pthread_exit().
void dce_exit | ( | int | status | ) |
Definition at line 70 of file dce-pthread.cc.
References ns3::DceManager::AppendProcFile(), ns3::DceManager::AppendStatusFile(), CleanupPthreadKeys(), ns3::Current(), ns3::TaskManager::Current(), dce___cxa_finalize(), dce_fflush(), ns3::DceManager::DeleteProcess(), ns3::TaskManager::Exit(), ns3::ProcessActivity::exitValue, ns3::Process::loader, ns3::Process::manager, ns3::Process::nodeId, ns3::ProcessActivity::ns3End, ns3::DceManager::PEC_EXIT, ns3::Process::pid, ns3::Thread::process, ns3::ProcessActivity::realEnd, ns3::Task::SetSwitchNotifier(), ns3::Thread::task, ns3::Process::timing, ns3::Loader::UnloadAll(), and ns3::UtilsGetNodeId().
Referenced by dce_abort(), dce_pthread_exit(), ns3::DceManager::DoExecProcess(), ns3::DceManager::DoStartProcess(), ns3::DceManager::SigabrtHandler(), and ns3::DceManager::SigkillHandler().
int dce_pthread_cancel | ( | pthread_t | thread | ) |
Definition at line 247 of file dce-pthread.cc.
int dce_pthread_create | ( | pthread_t * | thread_handle, |
const pthread_attr_t * | attr, | ||
void *(*)(void *) | start_routine, | ||
void * | arg | ||
) |
Definition at line 127 of file dce-pthread.cc.
References PthreadStartContext::arg, ns3::DceManager::CreateThread(), ns3::Current(), ns3::TaskManager::Current(), ns3::TaskManager::GetStackSize(), ns3::Process::manager, ns3::Process::pid, PidTidToPthread(), ns3::Thread::process, pthread_do_start(), PthreadTaskSwitch(), ns3::Task::SetContext(), ns3::Task::SetSwitchNotifier(), ns3::TaskManager::Start(), PthreadStartContext::start_routine, ns3::Thread::task, ns3::Process::threads, ns3::Thread::tid, ns3::UtilsGetNodeId(), and ns3::TaskManager::Yield().
int dce_pthread_detach | ( | pthread_t | thread_handle | ) |
Definition at line 222 of file dce-pthread.cc.
References ns3::Current(), ns3::Thread::isDetached, ns3::Thread::joinWaiter, ns3::Process::manager, ns3::Thread::process, PthreadToPid(), PthreadToTid(), ns3::DceManager::SearchThread(), and ns3::UtilsGetNodeId().
void dce_pthread_exit | ( | void * | arg | ) |
Definition at line 149 of file dce-pthread.cc.
References PthreadStartContext::arg, CleanupPthreadKeys(), ns3::Current(), ns3::TaskManager::Current(), dce_exit(), ns3::DceManager::DeleteThread(), ns3::TaskManager::Exit(), ns3::Thread::exitValue, ns3::Thread::hasExitValue, ns3::Thread::isDetached, ns3::Thread::joinWaiter, ns3::Process::manager, ns3::Thread::process, ns3::Thread::task, ns3::Process::threads, ns3::UtilsGetNodeId(), and ns3::DceManager::Wakeup().
Referenced by pthread_do_start().
void* dce_pthread_getspecific | ( | pthread_key_t | key | ) |
Definition at line 291 of file dce-pthread.cc.
References ns3::Current(), ns3::Thread::keyValues, and ns3::UtilsGetNodeId().
int dce_pthread_join | ( | pthread_t | thread_handle, |
void ** | value_ptr | ||
) |
Definition at line 181 of file dce-pthread.cc.
References ns3::Current(), ns3::DceManager::DeleteThread(), ns3::Thread::exitValue, ns3::Thread::hasExitValue, ns3::Thread::isDetached, ns3::Thread::joinWaiter, ns3::Process::manager, ns3::Process::pid, ns3::Thread::process, PthreadToPid(), PthreadToTid(), ns3::DceManager::SearchThread(), ns3::Thread::tid, ns3::UtilsGetNodeId(), and ns3::DceManager::Wait().
int dce_pthread_key_create | ( | pthread_key_t * | key, |
void(*)(void *) | destructor | ||
) |
Definition at line 323 of file dce-pthread.cc.
References ns3::Current(), ns3::ThreadKeyValue::destructor, IsKeyValid(), ns3::ThreadKeyValue::key, ns3::Thread::keyValues, ns3::Thread::process, ns3::Process::threads, ns3::UtilsGetNodeId(), and ns3::ThreadKeyValue::value.
int dce_pthread_key_delete | ( | pthread_key_t | key | ) |
Definition at line 353 of file dce-pthread.cc.
References ns3::Current(), IsKeyValid(), ns3::Thread::keyValues, ns3::Thread::process, ns3::Process::threads, and ns3::UtilsGetNodeId().
int dce_pthread_kill | ( | pthread_t | th, |
int | sig | ||
) |
Definition at line 382 of file dce-pthread.cc.
References ns3::Current(), ns3::Task::IsBlocked(), ns3::Process::manager, ns3::Thread::pendingSignals, ns3::Thread::process, PthreadToPid(), PthreadToTid(), ns3::DceManager::SearchThread(), ns3::Thread::signalMask, ns3::Thread::task, ns3::UtilsGetNodeId(), and ns3::DceManager::Wakeup().
int dce_pthread_once | ( | pthread_once_t * | once_control, |
void(*)(void) | init_routine | ||
) |
Definition at line 260 of file dce-pthread.cc.
References ns3::Current(), and ns3::UtilsGetNodeId().
pthread_t dce_pthread_self | ( | void | ) |
Definition at line 252 of file dce-pthread.cc.
References ns3::Current(), ns3::Process::pid, PidTidToPthread(), ns3::Thread::process, ns3::Thread::tid, and ns3::UtilsGetNodeId().
int dce_pthread_setspecific | ( | pthread_key_t | key, |
const void * | value | ||
) |
Definition at line 306 of file dce-pthread.cc.
References ns3::Current(), ns3::Thread::keyValues, and ns3::UtilsGetNodeId().
|
static |
Definition at line 278 of file dce-pthread.cc.
References ns3::Current(), and ns3::Thread::keyValues.
Referenced by dce_pthread_key_create(), and dce_pthread_key_delete().
NS_LOG_COMPONENT_DEFINE | ( | "SimuPthread" | ) |
|
static |
Definition at line 37 of file dce-pthread.cc.
Referenced by dce_pthread_create(), and dce_pthread_self().
|
static |
Definition at line 103 of file dce-pthread.cc.
References PthreadStartContext::arg, dce_pthread_exit(), and PthreadStartContext::start_routine.
Referenced by dce_pthread_create().
|
static |
Definition at line 112 of file dce-pthread.cc.
References ns3::Process::alloc, ns3::Task::FROM, ns3::Process::loader, ns3::Loader::NotifyEndExecute(), ns3::Loader::NotifyStartExecute(), KingsleyAlloc::SwitchTo(), and ns3::Task::TO.
Referenced by dce_pthread_create().
|
static |
Definition at line 30 of file dce-pthread.cc.
Referenced by dce_pthread_detach(), dce_pthread_join(), and dce_pthread_kill().
|
static |
Definition at line 23 of file dce-pthread.cc.
Referenced by dce_pthread_detach(), dce_pthread_join(), and dce_pthread_kill().