BasicTaskScheduler Class Reference

#include <BasicUsageEnvironment.hh>

Inheritance diagram for BasicTaskScheduler:

Inheritance graph
[legend]
Collaboration diagram for BasicTaskScheduler:

Collaboration graph
[legend]

Public Types

typedef void BackgroundHandlerProc (void *clientData, int mask)

Public Member Functions

virtual ~BasicTaskScheduler ()
virtual TaskToken scheduleDelayedTask (int64_t microseconds, TaskFunc *proc, void *clientData)
virtual void unscheduleDelayedTask (TaskToken &prevTask)
virtual void doEventLoop (char *watchVariable)
virtual EventTriggerId createEventTrigger (TaskFunc *eventHandlerProc)
virtual void deleteEventTrigger (EventTriggerId eventTriggerId)
virtual void triggerEvent (EventTriggerId eventTriggerId, void *clientData=NULL)
virtual void rescheduleDelayedTask (TaskToken &task, int64_t microseconds, TaskFunc *proc, void *clientData)
virtual void setBackgroundHandling (int socketNum, int conditionSet, BackgroundHandlerProc *handlerProc, void *clientData)=0
void disableBackgroundHandling (int socketNum)
void turnOnBackgroundReadHandling (int socketNum, BackgroundHandlerProc *handlerProc, void *clientData)
void turnOffBackgroundReadHandling (int socketNum)
virtual void internalError ()

Static Public Member Functions

static BasicTaskSchedulercreateNew (unsigned maxSchedulerGranularity=10000)

Protected Member Functions

 BasicTaskScheduler (unsigned maxSchedulerGranularity)
void schedulerTickTask ()
virtual void SingleStep (unsigned maxDelayTime)
virtual void setBackgroundHandling (int socketNum, int conditionSet, BackgroundHandlerProc *handlerProc, void *clientData)
virtual void moveSocketHandling (int oldSocketNum, int newSocketNum)

Static Protected Member Functions

static void schedulerTickTask (void *clientData)

Protected Attributes

unsigned fMaxSchedulerGranularity
int fMaxNumSockets
fd_set fReadSet
fd_set fWriteSet
fd_set fExceptionSet
DelayQueue fDelayQueue
HandlerSetfHandlers
int fLastHandledSocketNum
EventTriggerId fTriggersAwaitingHandling
EventTriggerId fLastUsedTriggerMask
TaskFuncfTriggeredEventHandlers [MAX_NUM_EVENT_TRIGGERS]
void * fTriggeredEventClientDatas [MAX_NUM_EVENT_TRIGGERS]
unsigned fLastUsedTriggerNum

Detailed Description

Definition at line 47 of file BasicUsageEnvironment.hh.


Member Typedef Documentation

typedef void TaskScheduler::BackgroundHandlerProc(void *clientData, int mask) [inherited]

Definition at line 128 of file UsageEnvironment.hh.


Constructor & Destructor Documentation

BasicTaskScheduler::~BasicTaskScheduler (  )  [virtual]

Definition at line 44 of file BasicTaskScheduler.cpp.

00044                                         {
00045 }

BasicTaskScheduler::BasicTaskScheduler ( unsigned  maxSchedulerGranularity  )  [protected]

Definition at line 35 of file BasicTaskScheduler.cpp.

References fExceptionSet, fReadSet, fWriteSet, and schedulerTickTask().

Referenced by createNew().

00036   : fMaxSchedulerGranularity(maxSchedulerGranularity), fMaxNumSockets(0) {
00037   FD_ZERO(&fReadSet);
00038   FD_ZERO(&fWriteSet);
00039   FD_ZERO(&fExceptionSet);
00040 
00041   if (maxSchedulerGranularity > 0) schedulerTickTask(); // ensures that we handle events frequently
00042 }


Member Function Documentation

BasicTaskScheduler * BasicTaskScheduler::createNew ( unsigned  maxSchedulerGranularity = 10000  )  [static]

Definition at line 31 of file BasicTaskScheduler.cpp.

References BasicTaskScheduler().

Referenced by main().

00031                                                                                   {
00032         return new BasicTaskScheduler(maxSchedulerGranularity);
00033 }

void BasicTaskScheduler::schedulerTickTask ( void *  clientData  )  [static, protected]

Definition at line 47 of file BasicTaskScheduler.cpp.

00047                                                            {
00048   ((BasicTaskScheduler*)clientData)->schedulerTickTask();
00049 }

void BasicTaskScheduler::schedulerTickTask (  )  [protected]

Definition at line 51 of file BasicTaskScheduler.cpp.

References fMaxSchedulerGranularity, and BasicTaskScheduler0::scheduleDelayedTask().

Referenced by BasicTaskScheduler().

void BasicTaskScheduler::SingleStep ( unsigned  maxDelayTime  )  [protected, virtual]

Implements BasicTaskScheduler0.

Definition at line 59 of file BasicTaskScheduler.cpp.

References HandlerDescriptor::clientData, HandlerDescriptor::conditionSet, BasicTaskScheduler0::fDelayQueue, fExceptionSet, BasicTaskScheduler0::fHandlers, BasicTaskScheduler0::fLastHandledSocketNum, BasicTaskScheduler0::fLastUsedTriggerMask, BasicTaskScheduler0::fLastUsedTriggerNum, fMaxNumSockets, fReadSet, BasicTaskScheduler0::fTriggeredEventClientDatas, BasicTaskScheduler0::fTriggeredEventHandlers, BasicTaskScheduler0::fTriggersAwaitingHandling, fWriteSet, DelayQueue::handleAlarm(), HandlerDescriptor::handlerProc, TaskScheduler::internalError(), iter, MAX_NUM_EVENT_TRIGGERS, MILLION, MediaSubsessionIterator::next(), NULL, MediaSubsessionIterator::reset(), Timeval::seconds(), setBackgroundHandling(), SOCKET_EXCEPTION, SOCKET_READABLE, SOCKET_WRITABLE, HandlerDescriptor::socketNum, DelayQueue::timeToNextAlarm(), and Timeval::useconds().

00059                                                          {
00060   fd_set readSet = fReadSet; // make a copy for this select() call
00061   fd_set writeSet = fWriteSet; // ditto
00062   fd_set exceptionSet = fExceptionSet; // ditto
00063 
00064   DelayInterval const& timeToDelay = fDelayQueue.timeToNextAlarm();
00065   struct timeval tv_timeToDelay;
00066   tv_timeToDelay.tv_sec = timeToDelay.seconds();
00067   tv_timeToDelay.tv_usec = timeToDelay.useconds();
00068   // Very large "tv_sec" values cause select() to fail.
00069   // Don't make it any larger than 1 million seconds (11.5 days)
00070   const long MAX_TV_SEC = MILLION;
00071   if (tv_timeToDelay.tv_sec > MAX_TV_SEC) {
00072     tv_timeToDelay.tv_sec = MAX_TV_SEC;
00073   }
00074   // Also check our "maxDelayTime" parameter (if it's > 0):
00075   if (maxDelayTime > 0 &&
00076       (tv_timeToDelay.tv_sec > (long)maxDelayTime/MILLION ||
00077        (tv_timeToDelay.tv_sec == (long)maxDelayTime/MILLION &&
00078         tv_timeToDelay.tv_usec > (long)maxDelayTime%MILLION))) {
00079     tv_timeToDelay.tv_sec = maxDelayTime/MILLION;
00080     tv_timeToDelay.tv_usec = maxDelayTime%MILLION;
00081   }
00082 
00083   int selectResult = select(fMaxNumSockets, &readSet, &writeSet, &exceptionSet, &tv_timeToDelay);
00084   if (selectResult < 0) {
00085 #if defined(__WIN32__) || defined(_WIN32)
00086     int err = WSAGetLastError();
00087     // For some unknown reason, select() in Windoze sometimes fails with WSAEINVAL if
00088     // it was called with no entries set in "readSet".  If this happens, ignore it:
00089     if (err == WSAEINVAL && readSet.fd_count == 0) {
00090       err = EINTR;
00091       // To stop this from happening again, create a dummy socket:
00092       int dummySocketNum = socket(AF_INET, SOCK_DGRAM, 0);
00093       FD_SET((unsigned)dummySocketNum, &fReadSet);
00094     }
00095     if (err != EINTR) {
00096 #else
00097     if (errno != EINTR && errno != EAGAIN) {
00098 #endif
00099         // Unexpected error - treat this as fatal:
00100 #if !defined(_WIN32_WCE)
00101         perror("BasicTaskScheduler::SingleStep(): select() fails");
00102         // Because this failure is often "Bad file descriptor" - which is caused by an invalid socket number (i.e., a socket number
00103         // that had already been closed) being used in "select()" - we print out the sockets that were being used in "select()",
00104         // to assist in debugging:
00105         fprintf(stderr, "socket numbers used in the select() call:");
00106         for (int i = 0; i < 10000; ++i) {
00107           if (FD_ISSET(i, &fReadSet) || FD_ISSET(i, &fWriteSet) || FD_ISSET(i, &fExceptionSet)) {
00108             fprintf(stderr, " %d(", i);
00109             if (FD_ISSET(i, &fReadSet)) fprintf(stderr, "r");
00110             if (FD_ISSET(i, &fWriteSet)) fprintf(stderr, "w");
00111             if (FD_ISSET(i, &fExceptionSet)) fprintf(stderr, "e");
00112             fprintf(stderr, ")");
00113           }
00114         }
00115         fprintf(stderr, "\n");
00116 #endif
00117         internalError();
00118       }
00119   }
00120 
00121   // Call the handler function for one readable socket:
00122   HandlerIterator iter(*fHandlers);
00123   HandlerDescriptor* handler;
00124   // To ensure forward progress through the handlers, begin past the last
00125   // socket number that we handled:
00126   if (fLastHandledSocketNum >= 0) {
00127     while ((handler = iter.next()) != NULL) {
00128       if (handler->socketNum == fLastHandledSocketNum) break;
00129     }
00130     if (handler == NULL) {
00131       fLastHandledSocketNum = -1;
00132       iter.reset(); // start from the beginning instead
00133     }
00134   }
00135   while ((handler = iter.next()) != NULL) {
00136     int sock = handler->socketNum; // alias
00137     int resultConditionSet = 0;
00138     if (FD_ISSET(sock, &readSet) && FD_ISSET(sock, &fReadSet)/*sanity check*/) resultConditionSet |= SOCKET_READABLE;
00139     if (FD_ISSET(sock, &writeSet) && FD_ISSET(sock, &fWriteSet)/*sanity check*/) resultConditionSet |= SOCKET_WRITABLE;
00140     if (FD_ISSET(sock, &exceptionSet) && FD_ISSET(sock, &fExceptionSet)/*sanity check*/) resultConditionSet |= SOCKET_EXCEPTION;
00141     if ((resultConditionSet&handler->conditionSet) != 0 && handler->handlerProc != NULL) {
00142       fLastHandledSocketNum = sock;
00143           // Note: we set "fLastHandledSocketNum" before calling the handler,
00144           // in case the handler calls "doEventLoop()" reentrantly.
00145       (*handler->handlerProc)(handler->clientData, resultConditionSet);
00146       break;
00147     }
00148   }
00149   if (handler == NULL && fLastHandledSocketNum >= 0) {
00150     // We didn't call a handler, but we didn't get to check all of them,
00151     // so try again from the beginning:
00152     iter.reset();
00153     while ((handler = iter.next()) != NULL) {
00154       int sock = handler->socketNum; // alias
00155       int resultConditionSet = 0;
00156       if (FD_ISSET(sock, &readSet) && FD_ISSET(sock, &fReadSet)/*sanity check*/) resultConditionSet |= SOCKET_READABLE;
00157       if (FD_ISSET(sock, &writeSet) && FD_ISSET(sock, &fWriteSet)/*sanity check*/) resultConditionSet |= SOCKET_WRITABLE;
00158       if (FD_ISSET(sock, &exceptionSet) && FD_ISSET(sock, &fExceptionSet)/*sanity check*/) resultConditionSet |= SOCKET_EXCEPTION;
00159       if ((resultConditionSet&handler->conditionSet) != 0 && handler->handlerProc != NULL) {
00160         fLastHandledSocketNum = sock;
00161             // Note: we set "fLastHandledSocketNum" before calling the handler,
00162             // in case the handler calls "doEventLoop()" reentrantly.
00163         (*handler->handlerProc)(handler->clientData, resultConditionSet);
00164         break;
00165       }
00166     }
00167     if (handler == NULL) fLastHandledSocketNum = -1;//because we didn't call a handler
00168   }
00169 
00170   // Also handle any newly-triggered event (Note that we do this *after* calling a socket handler,
00171   // in case the triggered event handler modifies The set of readable sockets.)
00172   if (fTriggersAwaitingHandling != 0) {
00173     if (fTriggersAwaitingHandling == fLastUsedTriggerMask) {
00174       // Common-case optimization for a single event trigger:
00175       fTriggersAwaitingHandling = 0;
00176       if (fTriggeredEventHandlers[fLastUsedTriggerNum] != NULL) {
00177         (*fTriggeredEventHandlers[fLastUsedTriggerNum])(fTriggeredEventClientDatas[fLastUsedTriggerNum]);
00178       }
00179     } else {
00180       // Look for an event trigger that needs handling (making sure that we make forward progress through all possible triggers):
00181       unsigned i = fLastUsedTriggerNum;
00182       EventTriggerId mask = fLastUsedTriggerMask;
00183 
00184       do {
00185         i = (i+1)%MAX_NUM_EVENT_TRIGGERS;
00186         mask >>= 1;
00187         if (mask == 0) mask = 0x80000000;
00188 
00189         if ((fTriggersAwaitingHandling&mask) != 0) {
00190           fTriggersAwaitingHandling &=~ mask;
00191           if (fTriggeredEventHandlers[i] != NULL) {
00192             (*fTriggeredEventHandlers[i])(fTriggeredEventClientDatas[i]);
00193           }
00194 
00195           fLastUsedTriggerMask = mask;
00196           fLastUsedTriggerNum = i;
00197           break;
00198         }
00199       } while (i != fLastUsedTriggerNum);
00200     }
00201   }
00202 
00203   // Also handle any delayed event that may have come due.
00204   fDelayQueue.handleAlarm();
00205 }

void BasicTaskScheduler::setBackgroundHandling ( int  socketNum,
int  conditionSet,
BackgroundHandlerProc handlerProc,
void *  clientData 
) [protected, virtual]

Definition at line 208 of file BasicTaskScheduler.cpp.

References HandlerSet::assignHandler(), HandlerSet::clearHandler(), fExceptionSet, BasicTaskScheduler0::fHandlers, fMaxNumSockets, fReadSet, fWriteSet, SOCKET_EXCEPTION, SOCKET_READABLE, and SOCKET_WRITABLE.

Referenced by SingleStep().

00208                                                                                                                {
00209   if (socketNum < 0) return;
00210   FD_CLR((unsigned)socketNum, &fReadSet);
00211   FD_CLR((unsigned)socketNum, &fWriteSet);
00212   FD_CLR((unsigned)socketNum, &fExceptionSet);
00213   if (conditionSet == 0) {
00214     fHandlers->clearHandler(socketNum);
00215     if (socketNum+1 == fMaxNumSockets) {
00216       --fMaxNumSockets;
00217     }
00218   } else {
00219     fHandlers->assignHandler(socketNum, conditionSet, handlerProc, clientData);
00220     if (socketNum+1 > fMaxNumSockets) {
00221       fMaxNumSockets = socketNum+1;
00222     }
00223     if (conditionSet&SOCKET_READABLE) FD_SET((unsigned)socketNum, &fReadSet);
00224     if (conditionSet&SOCKET_WRITABLE) FD_SET((unsigned)socketNum, &fWriteSet);
00225     if (conditionSet&SOCKET_EXCEPTION) FD_SET((unsigned)socketNum, &fExceptionSet);
00226   }
00227 }

void BasicTaskScheduler::moveSocketHandling ( int  oldSocketNum,
int  newSocketNum 
) [protected, virtual]

Implements TaskScheduler.

Definition at line 229 of file BasicTaskScheduler.cpp.

References fExceptionSet, BasicTaskScheduler0::fHandlers, fMaxNumSockets, fReadSet, fWriteSet, and HandlerSet::moveHandler().

00229                                                                               {
00230   if (oldSocketNum < 0 || newSocketNum < 0) return; // sanity check
00231   if (FD_ISSET(oldSocketNum, &fReadSet)) {FD_CLR((unsigned)oldSocketNum, &fReadSet); FD_SET((unsigned)newSocketNum, &fReadSet);}
00232   if (FD_ISSET(oldSocketNum, &fWriteSet)) {FD_CLR((unsigned)oldSocketNum, &fWriteSet); FD_SET((unsigned)newSocketNum, &fWriteSet);}
00233   if (FD_ISSET(oldSocketNum, &fExceptionSet)) {FD_CLR((unsigned)oldSocketNum, &fExceptionSet); FD_SET((unsigned)newSocketNum, &fExceptionSet);}
00234   fHandlers->moveHandler(oldSocketNum, newSocketNum);
00235 
00236   if (oldSocketNum+1 == fMaxNumSockets) {
00237     --fMaxNumSockets;
00238   }
00239   if (newSocketNum+1 > fMaxNumSockets) {
00240     fMaxNumSockets = newSocketNum+1;
00241   }
00242 }

TaskToken BasicTaskScheduler0::scheduleDelayedTask ( int64_t  microseconds,
TaskFunc proc,
void *  clientData 
) [virtual, inherited]

Implements TaskScheduler.

Definition at line 59 of file BasicTaskScheduler0.cpp.

References DelayQueue::addEntry(), BasicTaskScheduler0::fDelayQueue, and DelayQueueEntry::token().

Referenced by schedulerTickTask().

00061                                                                    {
00062   if (microseconds < 0) microseconds = 0;
00063   DelayInterval timeToDelay((long)(microseconds/1000000), (long)(microseconds%1000000));
00064   AlarmHandler* alarmHandler = new AlarmHandler(proc, clientData, timeToDelay);
00065   fDelayQueue.addEntry(alarmHandler);
00066 
00067   return (void*)(alarmHandler->token());
00068 }

void BasicTaskScheduler0::unscheduleDelayedTask ( TaskToken prevTask  )  [virtual, inherited]

Implements TaskScheduler.

Definition at line 70 of file BasicTaskScheduler0.cpp.

References BasicTaskScheduler0::fDelayQueue, NULL, and DelayQueue::removeEntry().

00070                                                                    {
00071   DelayQueueEntry* alarmHandler = fDelayQueue.removeEntry((intptr_t)prevTask);
00072   prevTask = NULL;
00073   delete alarmHandler;
00074 }

void BasicTaskScheduler0::doEventLoop ( char *  watchVariable  )  [virtual, inherited]

Implements TaskScheduler.

Definition at line 76 of file BasicTaskScheduler0.cpp.

References NULL, and BasicTaskScheduler0::SingleStep().

00076                                                          {
00077   // Repeatedly loop, handling readble sockets and timed events:
00078   while (1) {
00079     if (watchVariable != NULL && *watchVariable != 0) break;
00080     SingleStep();
00081   }
00082 }

EventTriggerId BasicTaskScheduler0::createEventTrigger ( TaskFunc eventHandlerProc  )  [virtual, inherited]

Implements TaskScheduler.

Definition at line 84 of file BasicTaskScheduler0.cpp.

References BasicTaskScheduler0::fLastUsedTriggerMask, BasicTaskScheduler0::fLastUsedTriggerNum, BasicTaskScheduler0::fTriggeredEventClientDatas, BasicTaskScheduler0::fTriggeredEventHandlers, MAX_NUM_EVENT_TRIGGERS, and NULL.

00084                                                                                  {
00085   unsigned i = fLastUsedTriggerNum;
00086   EventTriggerId mask = fLastUsedTriggerMask;
00087 
00088   do {
00089     i = (i+1)%MAX_NUM_EVENT_TRIGGERS;
00090     mask >>= 1;
00091     if (mask == 0) mask = 0x80000000;
00092 
00093     if (fTriggeredEventHandlers[i] == NULL) {
00094       // This trigger number is free; use it:
00095       fTriggeredEventHandlers[i] = eventHandlerProc;
00096       fTriggeredEventClientDatas[i] = NULL; // sanity
00097 
00098       fLastUsedTriggerMask = mask;
00099       fLastUsedTriggerNum = i;
00100 
00101       return mask;
00102     }
00103   } while (i != fLastUsedTriggerNum);
00104 
00105   // All available event triggers are allocated; return 0 instead:
00106   return 0;
00107 }

void BasicTaskScheduler0::deleteEventTrigger ( EventTriggerId  eventTriggerId  )  [virtual, inherited]

Implements TaskScheduler.

Definition at line 109 of file BasicTaskScheduler0.cpp.

References BasicTaskScheduler0::fLastUsedTriggerMask, BasicTaskScheduler0::fLastUsedTriggerNum, BasicTaskScheduler0::fTriggeredEventClientDatas, BasicTaskScheduler0::fTriggeredEventHandlers, BasicTaskScheduler0::fTriggersAwaitingHandling, MAX_NUM_EVENT_TRIGGERS, and NULL.

00109                                                                           {
00110   fTriggersAwaitingHandling &=~ eventTriggerId;
00111 
00112   if (eventTriggerId == fLastUsedTriggerMask) { // common-case optimization:
00113     fTriggeredEventHandlers[fLastUsedTriggerNum] = NULL;
00114     fTriggeredEventClientDatas[fLastUsedTriggerNum] = NULL;
00115   } else {
00116     // "eventTriggerId" should have just one bit set.
00117     // However, we do the reasonable thing if the user happened to 'or' together two or more "EventTriggerId"s:
00118     EventTriggerId mask = 0x80000000;
00119     for (unsigned i = 0; i < MAX_NUM_EVENT_TRIGGERS; ++i) {
00120       if ((eventTriggerId&mask) != 0) {
00121         fTriggeredEventHandlers[i] = NULL;
00122         fTriggeredEventClientDatas[i] = NULL;
00123       }
00124       mask >>= 1;
00125     }
00126   }
00127 }

void BasicTaskScheduler0::triggerEvent ( EventTriggerId  eventTriggerId,
void *  clientData = NULL 
) [virtual, inherited]

Implements TaskScheduler.

Definition at line 129 of file BasicTaskScheduler0.cpp.

References BasicTaskScheduler0::fTriggeredEventClientDatas, BasicTaskScheduler0::fTriggersAwaitingHandling, and MAX_NUM_EVENT_TRIGGERS.

00129                                                                                       {
00130   // First, record the "clientData".  (Note that we allow "eventTriggerId" to be a combination of bits for multiple events.)
00131   EventTriggerId mask = 0x80000000;
00132   for (unsigned i = 0; i < MAX_NUM_EVENT_TRIGGERS; ++i) {
00133     if ((eventTriggerId&mask) != 0) {
00134       fTriggeredEventClientDatas[i] = clientData;
00135     }
00136     mask >>= 1;
00137   }
00138 
00139   // Then, note this event as being ready to be handled.
00140   // (Note that because this function (unlike others in the library) can be called from an external thread, we do this last, to
00141   //  reduce the risk of a race condition.)
00142   fTriggersAwaitingHandling |= eventTriggerId;
00143 }

void TaskScheduler::rescheduleDelayedTask ( TaskToken task,
int64_t  microseconds,
TaskFunc proc,
void *  clientData 
) [virtual, inherited]

Definition at line 47 of file UsageEnvironment.cpp.

References TaskScheduler::scheduleDelayedTask(), and TaskScheduler::unscheduleDelayedTask().

Referenced by RTSPServer::RTSPClientSession::noteLiveness().

00049                                                             {
00050   unscheduleDelayedTask(task);
00051   task = scheduleDelayedTask(microseconds, proc, clientData);
00052 }

virtual void TaskScheduler::setBackgroundHandling ( int  socketNum,
int  conditionSet,
BackgroundHandlerProc handlerProc,
void *  clientData 
) [pure virtual, inherited]

Referenced by RTSPServer::RTSPClientConnection::changeClientInputSocket(), RTSPClient::connectionHandler1(), RTSPClient::connectToServer(), TaskScheduler::disableBackgroundHandling(), RTSPServer::RTSPClientConnection::handleAlternativeRequestByte1(), RTSPClient::handleAlternativeRequestByte1(), RTSPClient::openConnection(), TCPStreamSink::processBuffer(), RTSPClient::RTSPClient(), RTSPServer::RTSPClientConnection::RTSPClientConnection(), and TaskScheduler::turnOnBackgroundReadHandling().

void TaskScheduler::disableBackgroundHandling ( int  socketNum  )  [inline, inherited]

Definition at line 135 of file UsageEnvironment.hh.

References NULL, and TaskScheduler::setBackgroundHandling().

Referenced by RTSPServer::RTSPClientConnection::changeClientInputSocket(), RTSPServer::RTSPClientConnection::closeSockets(), RTSPClient::connectionHandler1(), RTSPClient::resetTCPSockets(), RTPInterface::setStreamSocket(), TCPStreamSink::socketWritableHandler1(), TaskScheduler::turnOffBackgroundReadHandling(), and TCPStreamSink::~TCPStreamSink().

00135 { setBackgroundHandling(socketNum, 0, NULL, NULL); }

void TaskScheduler::turnOnBackgroundReadHandling ( int  socketNum,
BackgroundHandlerProc handlerProc,
void *  clientData 
) [inline, inherited]

Definition at line 155 of file UsageEnvironment.hh.

References TaskScheduler::setBackgroundHandling(), and SOCKET_READABLE.

Referenced by WAVAudioFileSource::doGetNextFrame(), ByteStreamFileSource::doGetNextFrame(), BasicUDPSource::doGetNextFrame(), SIPClient::invite1(), RTSPServer::RTSPServer(), and RTSPServer::setUpTunnelingOverHTTP().

00155                                                                                                          {
00156     setBackgroundHandling(socketNum, SOCKET_READABLE, handlerProc, clientData);
00157   }

void TaskScheduler::turnOffBackgroundReadHandling ( int  socketNum  )  [inline, inherited]

Definition at line 158 of file UsageEnvironment.hh.

References TaskScheduler::disableBackgroundHandling().

Referenced by RTCPInstance::addStreamSocket(), Socket::changePort(), WAVAudioFileSource::doStopGettingFrames(), ByteStreamFileSource::doStopGettingFrames(), BasicUDPSource::doStopGettingFrames(), SIPClient::invite1(), RTPInterface::stopNetworkReading(), BasicUDPSource::~BasicUDPSource(), ByteStreamFileSource::~ByteStreamFileSource(), RTSPServer::~RTSPServer(), SocketDescriptor::~SocketDescriptor(), and WAVAudioFileSource::~WAVAudioFileSource().

00158 { disableBackgroundHandling(socketNum); }

void TaskScheduler::internalError (  )  [virtual, inherited]

Definition at line 55 of file UsageEnvironment.cpp.

Referenced by SingleStep().

00055                                   {
00056   abort();
00057 }


Field Documentation

unsigned BasicTaskScheduler::fMaxSchedulerGranularity [protected]

Definition at line 71 of file BasicUsageEnvironment.hh.

Referenced by schedulerTickTask().

int BasicTaskScheduler::fMaxNumSockets [protected]

Definition at line 74 of file BasicUsageEnvironment.hh.

Referenced by moveSocketHandling(), setBackgroundHandling(), and SingleStep().

fd_set BasicTaskScheduler::fReadSet [protected]

Definition at line 75 of file BasicUsageEnvironment.hh.

Referenced by BasicTaskScheduler(), moveSocketHandling(), setBackgroundHandling(), and SingleStep().

fd_set BasicTaskScheduler::fWriteSet [protected]

Definition at line 76 of file BasicUsageEnvironment.hh.

Referenced by BasicTaskScheduler(), moveSocketHandling(), setBackgroundHandling(), and SingleStep().

fd_set BasicTaskScheduler::fExceptionSet [protected]

Definition at line 77 of file BasicUsageEnvironment.hh.

Referenced by BasicTaskScheduler(), moveSocketHandling(), setBackgroundHandling(), and SingleStep().

DelayQueue BasicTaskScheduler0::fDelayQueue [protected, inherited]

Definition at line 100 of file BasicUsageEnvironment0.hh.

Referenced by BasicTaskScheduler0::scheduleDelayedTask(), SingleStep(), and BasicTaskScheduler0::unscheduleDelayedTask().

HandlerSet* BasicTaskScheduler0::fHandlers [protected, inherited]

Definition at line 103 of file BasicUsageEnvironment0.hh.

Referenced by BasicTaskScheduler0::BasicTaskScheduler0(), moveSocketHandling(), setBackgroundHandling(), SingleStep(), and BasicTaskScheduler0::~BasicTaskScheduler0().

int BasicTaskScheduler0::fLastHandledSocketNum [protected, inherited]

Definition at line 104 of file BasicUsageEnvironment0.hh.

Referenced by SingleStep().

EventTriggerId BasicTaskScheduler0::fTriggersAwaitingHandling [protected, inherited]

Definition at line 107 of file BasicUsageEnvironment0.hh.

Referenced by BasicTaskScheduler0::deleteEventTrigger(), SingleStep(), and BasicTaskScheduler0::triggerEvent().

EventTriggerId BasicTaskScheduler0::fLastUsedTriggerMask [protected, inherited]

Definition at line 107 of file BasicUsageEnvironment0.hh.

Referenced by BasicTaskScheduler0::createEventTrigger(), BasicTaskScheduler0::deleteEventTrigger(), and SingleStep().

TaskFunc* BasicTaskScheduler0::fTriggeredEventHandlers[MAX_NUM_EVENT_TRIGGERS] [protected, inherited]

Definition at line 108 of file BasicUsageEnvironment0.hh.

Referenced by BasicTaskScheduler0::BasicTaskScheduler0(), BasicTaskScheduler0::createEventTrigger(), BasicTaskScheduler0::deleteEventTrigger(), and SingleStep().

void* BasicTaskScheduler0::fTriggeredEventClientDatas[MAX_NUM_EVENT_TRIGGERS] [protected, inherited]

Definition at line 109 of file BasicUsageEnvironment0.hh.

Referenced by BasicTaskScheduler0::BasicTaskScheduler0(), BasicTaskScheduler0::createEventTrigger(), BasicTaskScheduler0::deleteEventTrigger(), SingleStep(), and BasicTaskScheduler0::triggerEvent().

unsigned BasicTaskScheduler0::fLastUsedTriggerNum [protected, inherited]

Definition at line 110 of file BasicUsageEnvironment0.hh.

Referenced by BasicTaskScheduler0::createEventTrigger(), BasicTaskScheduler0::deleteEventTrigger(), and SingleStep().


The documentation for this class was generated from the following files:
Generated on Tue Mar 25 14:39:14 2014 for live by  doxygen 1.5.2