[Live-devel] BasicTaskScheduler not reading fast enough?
Rawling, Stuart
SRawling at pelco.com
Wed Oct 28 19:44:51 PDT 2009
>The problem with this is that it can potentially lead to 'livelock'
>Situations - e.g., if the handler of a 'delayed task' itself calls
>"TaskScheduler::schedulerDelayedTask()" to set up a new delayed task
>(especially if the 'delay' is zero). That's why
>"BasicTaskScheduler::SingleStep()" always tries to handle at least
>one socket (and iterates through all the available sockets).
Are you saying that my optimization for handling alarms early could cause an
issue? ( I also call it after
the select as well).
I understand your statement to indicate that if the task that is called in
fDelayQueue.handleAlarm
adds an schedules an additional task, then this would also have to be
handled in the handleAlarm function.
If so, isn¹t this also the case when we call handleAlarm after the select?
Another thing I noticed was that I do not believe the turnOn /
turnOffBackgroundReadHandling
functions are handling the fMaxNumSockets in the most efficient way. When I
read the man page for
select it says:
³ nfds is the highest-numbered file descriptor in any of the three sets,
plus 1.³
(On windows I believe nfds is ignored).
Looking at the code, the turnOn function seems to be fine, but the turnOff
function just negates
the fMaxNumSockets variable, rather than finding the current highest
numbered file descriptor.
For example, if we added fds: 1, 2, 99 then fMaxNumSockets becomes 100. If
we then removed 99,
fMaxNumSockets becomes 99, not 3 as I would expect (and select expects
according to the man page).
I am not sure how select is implemented under the hood, but I am guessing
this might cause an
inefficiency as I suspect it tests all file descriptors between 0 and nfds
1;
Regards,
Stuart
- ------------------------------------------------------------------------------
Confidentiality Notice: The information contained in this transmission is legally privileged and confidential, intended only for the use of the individual(s) or entities named above. This email and any files transmitted with it are the property of Pelco. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any review, disclosure, copying, distribution, retention, or any action taken or omitted to be taken in reliance on it is prohibited and may be unlawful. If you receive this communication in error, please notify us immediately by telephone call to +1-559-292-1981 or forward the e-mail to administrator at pelco.com and then permanently delete the e-mail and destroy all soft and hard copies of the message and any attachments. Thank you for your cooperation.
- ------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20091028/ac14a261/attachment.html>
More information about the live-devel
mailing list