XRootD
XrdSysThread Class Reference

#include <XrdSysPthread.hh>

+ Collaboration diagram for XrdSysThread:

Public Member Functions

 XrdSysThread ()
 
 ~XrdSysThread ()
 

Static Public Member Functions

static int Cancel (pthread_t tid)
 
static void CancelPoint ()
 
static int Detach (pthread_t tid)
 
static pthread_t ID (void)
 
static int Join (pthread_t tid, void **ret)
 
static int Kill (pthread_t tid)
 
static unsigned long Num (void)
 
static int Run (pthread_t *, void *(*proc)(void *), void *arg, int opts=0, const char *desc=0)
 
static int Same (pthread_t t1, pthread_t t2)
 
static int SetCancelAsynchronous ()
 
static int SetCancelDeferred ()
 
static int SetCancelOff ()
 
static int SetCancelOn ()
 
static void setDebug (XrdSysError *erp)
 
static void setStackSize (size_t stsz, bool force=false)
 
static int Signal (pthread_t tid, int snum)
 
static int Wait (pthread_t tid)
 

Detailed Description

Definition at line 550 of file XrdSysPthread.hh.

Constructor & Destructor Documentation

◆ XrdSysThread()

XrdSysThread::XrdSysThread ( )
inline

Definition at line 605 of file XrdSysPthread.hh.

605 {}

◆ ~XrdSysThread()

XrdSysThread::~XrdSysThread ( )
inline

Definition at line 606 of file XrdSysPthread.hh.

606 {}

Member Function Documentation

◆ Cancel()

static int XrdSysThread::Cancel ( pthread_t  tid)
inlinestatic

Definition at line 554 of file XrdSysPthread.hh.

554 {return pthread_cancel(tid);}

◆ CancelPoint()

static void XrdSysThread::CancelPoint ( )
inlinestatic

Definition at line 579 of file XrdSysPthread.hh.

579  {
580  pthread_testcancel();
581  };

◆ Detach()

static int XrdSysThread::Detach ( pthread_t  tid)
inlinestatic

Definition at line 556 of file XrdSysPthread.hh.

556 {return pthread_detach(tid);}

◆ ID()

static pthread_t XrdSysThread::ID ( void  )
inlinestatic

Definition at line 584 of file XrdSysPthread.hh.

584 {return pthread_self();}

Referenced by XrdSys::IOEvents::Channel::Delete(), XrdOucBackTrace::DoBT(), XrdSys::IOEvents::BootStrap::Start(), and XrdOucBackTrace::XrdBT().

+ Here is the caller graph for this function:

◆ Join()

static int XrdSysThread::Join ( pthread_t  tid,
void **  ret 
)
inlinestatic

Definition at line 563 of file XrdSysPthread.hh.

563  {
564  return pthread_join(tid, ret);
565  };

Referenced by XrdSecsssKT::~XrdSecsssKT().

+ Here is the caller graph for this function:

◆ Kill()

static int XrdSysThread::Kill ( pthread_t  tid)
inlinestatic

Definition at line 586 of file XrdSysPthread.hh.

586 {return pthread_cancel(tid);}

Referenced by XrdBwmLogger::~XrdBwmLogger(), XrdCmsMeter::~XrdCmsMeter(), XrdOfsEvs::~XrdOfsEvs(), XrdSecsssKT::~XrdSecsssKT(), and XrdSysLogger::Bind().

+ Here is the caller graph for this function:

◆ Num()

unsigned long XrdSysThread::Num ( void  )
static

Definition at line 290 of file XrdSysPthread.cc.

291 {
292 #if defined(__linux__)
293  return static_cast<unsigned long>(syscall(SYS_gettid));
294 #elif defined(__solaris__)
295  return static_cast<unsigned long>(pthread_self());
296 #elif defined(__APPLE__)
297  return static_cast<unsigned long>(pthread_mach_thread_np(pthread_self()));
298 #else
299  return static_cast<unsigned long>(getpid());
300 #endif
301 }

Referenced by XrdThrottleManager::CloseFile(), XrdThrottleManager::OpenFile(), and XrdSysLogger::Put().

+ Here is the caller graph for this function:

◆ Run()

int XrdSysThread::Run ( pthread_t *  tid,
void *(*)(void *)  proc,
void *  arg,
int  opts = 0,
const char *  desc = 0 
)
static

Definition at line 307 of file XrdSysPthread.cc.

309 {
310  pthread_attr_t tattr;
311  XrdSysThreadArgs *myargs;
312 
313  myargs = new XrdSysThreadArgs(eDest, tDesc, proc, arg);
314 
315  pthread_attr_init(&tattr);
316  if ( opts & XRDSYSTHREAD_BIND)
317  pthread_attr_setscope(&tattr, PTHREAD_SCOPE_SYSTEM);
318  if (!(opts & XRDSYSTHREAD_HOLD))
319  pthread_attr_setdetachstate(&tattr, PTHREAD_CREATE_DETACHED);
320  if (stackSize)
321  pthread_attr_setstacksize(&tattr, stackSize);
322  return pthread_create(tid, &tattr, XrdSysThread_Xeq,
323  static_cast<void *>(myargs));
324 }
struct myOpts opts
void * XrdSysThread_Xeq(void *myargs)
#define XRDSYSTHREAD_BIND
#define XRDSYSTHREAD_HOLD

References eDest, opts, XRDSYSTHREAD_BIND, XRDSYSTHREAD_HOLD, and XrdSysThread_Xeq().

Referenced by StatsFileSystem::StatsFileSystem(), XrdRmcReal::XrdRmcReal(), XrdSecsssKT::XrdSecsssKT(), XrdTlsTempCA::XrdTlsTempCA(), XrdOssSys::AioInit(), XrdSysLogger::Bind(), XrdOucLogging::configLog(), XrdOssSys::ConfigStageC(), XrdOssSys::Configure(), XrdCmsFinderTRG::Configure(), XrdAccConfig::Configure(), XrdSysLogging::Configure(), XrdSys::IOEvents::Poller::Create(), XrdCmsConfig::DoIt(), XrdScheduler::Fork(), XrdPosixFileRH::HandleResponse(), XrdBuffManager::Init(), XrdCmsMeter::Init(), XrdFrmTransfer::Init(), XrdFrmXfrQueue::Init(), XrdThrottleManager::Init(), XrdFrmMonitor::Init(), XrdCmsCache::Init(), XrdCmsRRQ::Init(), XrdOfsEvr::Init(), XrdXrootdAdmin::Init(), XrdCmsAdmin::InitAREvents(), main(), mainConfig(), XrdOssMio::Map(), XrdFrmMigrate::Migrate(), XrdCmsMeter::Monitor(), XrdFrmXfrDaemon::Pong(), XrdCmsFinderTRG::RunAdmin(), XrdOfsTPCAuth::RunTTL(), XrdPosixFileRH::Sched(), XrdTlsContext::SetCrlRefresh(), XrdBwmHandle::setPolicy(), XrdPoll::Setup(), XrdTlsFlush::Setup_Flusher(), XrdScheduler::Start(), XrdCmsBaseFS::Start(), XrdFrmReqBoss::Start(), XrdCmsAdmin::Start(), XrdXrootdAdmin::Start(), XrdOfsTPCProg::Start(), XrdBwmLogger::Start(), XrdOfsEvs::Start(), XrdOfsHandle::StartXpr(), XrdW41Gate::Wait41(), XrdOucGetCache(), and XrdSysLogger::zHandler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Same()

static int XrdSysThread::Same ( pthread_t  t1,
pthread_t  t2 
)
inlinestatic

Definition at line 593 of file XrdSysPthread.hh.

594  {return pthread_equal(t1, t2);}

Referenced by XrdSys::IOEvents::Channel::Delete().

+ Here is the caller graph for this function:

◆ SetCancelAsynchronous()

static int XrdSysThread::SetCancelAsynchronous ( )
inlinestatic

Definition at line 571 of file XrdSysPthread.hh.

571  {
572  return pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, 0);
573  };

◆ SetCancelDeferred()

static int XrdSysThread::SetCancelDeferred ( )
inlinestatic

Definition at line 575 of file XrdSysPthread.hh.

575  {
576  return pthread_setcanceltype(PTHREAD_CANCEL_DEFERRED, 0);
577  };

◆ SetCancelOff()

static int XrdSysThread::SetCancelOff ( )
inlinestatic

Definition at line 559 of file XrdSysPthread.hh.

559  {
560  return pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, 0);
561  };

◆ SetCancelOn()

static int XrdSysThread::SetCancelOn ( )
inlinestatic

Definition at line 567 of file XrdSysPthread.hh.

567  {
568  return pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, 0);
569  };

◆ setDebug()

static void XrdSysThread::setDebug ( XrdSysError erp)
inlinestatic

Definition at line 596 of file XrdSysPthread.hh.

596 {eDest = erp;}

Referenced by XrdConfig::Configure().

+ Here is the caller graph for this function:

◆ setStackSize()

void XrdSysThread::setStackSize ( size_t  stsz,
bool  force = false 
)
static

Definition at line 330 of file XrdSysPthread.cc.

331 {
332 // If not being forced, then we set the stacksize only if the requested
333 // size is greater than the default size.
334 //
335 if (!force)
336  {pthread_attr_t tattr;
337  size_t dflt_stk_sz;
338  pthread_attr_init(&tattr);
339  if (pthread_attr_getstacksize(&tattr, &dflt_stk_sz) || stksz <= dflt_stk_sz)
340  {stackSize = 0;
341  return;
342  }
343  }
344 
345 // Record the stack size for future use
346 //
347  stackSize = stksz;
348 }

Referenced by main().

+ Here is the caller graph for this function:

◆ Signal()

static int XrdSysThread::Signal ( pthread_t  tid,
int  snum 
)
inlinestatic

Definition at line 600 of file XrdSysPthread.hh.

601  {return pthread_kill(tid, snum);}

◆ Wait()

int XrdSysThread::Wait ( pthread_t  tid)
static

Definition at line 354 of file XrdSysPthread.cc.

355 {
356  int retc, *tstat;
357  if ((retc = pthread_join(tid, reinterpret_cast<void **>(&tstat)))) return retc;
358  return *tstat;
359 }

The documentation for this class was generated from the following files: