[FFmpeg-devel] [PATCH] What is missing for working AVFMT_FLAG_NONBLOCK?

Luca Abeni lucabe72
Tue Mar 3 23:13:10 CET 2009


Hi Nicolas,

Nicolas George wrote:
> Hi.
> 
> Le tridi 13 vent?se, an CCXVII, Michael Niedermayer a ?crit :
>> are you saying that sched_yield() will blow up and cause actual undefined
>> behaviour and that we should use usleep(0) or what else?
>> I really feel that sched_yield() is correct and usleep() is not.
>> thats IMHO from reading POSIX and the man pages
> 
> I remember a message on lkml where someone really good explained that
> sched_yield is very rarely useful, and that most of the times people use it
> wrongly.
> 
> What sched_yield does is the following:
> 
> It several processes are competing to hog one CPU and have the same
> priority, each in turn get some CPU time, and when that time is exhausted,
> they are preempted and the CPU goes to the next one.
[...]

While I agree with your example, note that here you are talking about 
priority scheduling... It is not immediate to apply this to other kinds 
of schedulers, such as proportional share ones. For example, it is not 
clear what "having the same priority" means in case for CFS; so, the 
sched_yield behaviour for SCHED_OTHER tasks is not well defined (I think 
linux even has - or had - a proc entry for changing this behaviour).


				Luca




More information about the ffmpeg-devel mailing list