XrdClientThread.cc

Go to the documentation of this file.
00001 //////////////////////////////////////////////////////////////////////////
00002 //                                                                      //
00003 // XrdClientThread                                                      //
00004 //                                                                      //
00005 // An user friendly thread wrapper                                      //
00006 // Author: F.Furano (INFN, 2005)                                        //
00007 //                                                                      //
00008 //////////////////////////////////////////////////////////////////////////
00009 
00010 //           $Id: XrdClientThread.cc 22437 2008-03-04 14:35:16Z rdm $
00011 
00012 const char *XrdClientThreadCVSID = "$Id: XrdClientThread.cc 22437 2008-03-04 14:35:16Z rdm $";
00013 
00014 #include <pthread.h>
00015 #include <signal.h>
00016 
00017 #include "XrdClient/XrdClientThread.hh"
00018 
00019 //_____________________________________________________________________________
00020 void * XrdClientThreadDispatcher(void * arg)
00021 {
00022    // This function is launched by the thread implementation. Its purpose
00023    // is to call the actual thread body, passing to it the original arg and
00024    // a pointer to the thread object which launched it.
00025 
00026    XrdClientThread::XrdClientThreadArgs *args = (XrdClientThread::XrdClientThreadArgs *)arg;
00027 
00028    args->threadobj->SetCancelDeferred();
00029    args->threadobj->SetCancelOn();
00030 
00031    if (args->threadobj->ThreadFunc)
00032       return args->threadobj->ThreadFunc(args->arg, args->threadobj);
00033 
00034    return 0;
00035 
00036 }
00037 
00038 //_____________________________________________________________________________
00039 int XrdClientThread::MaskSignal(int snum, bool block)
00040 {
00041    // Modify masking for signal snum: if block is true the signal is blocked,
00042    // else is unblocked. If snum <= 0 (default) all the allowed signals are
00043    // blocked / unblocked.
00044 #ifndef WIN32
00045    sigset_t mask;
00046    int how = block ? SIG_BLOCK : SIG_UNBLOCK;
00047    if (snum <= 0)
00048       sigfillset(&mask);
00049       else sigaddset(&mask, snum);
00050    return pthread_sigmask(how, &mask, 0);
00051 #else
00052    return 0;
00053 #endif
00054 }
00055 
00056 

Generated on Tue Jul 5 14:46:18 2011 for ROOT_528-00b_version by  doxygen 1.5.1