[vlc-devel] [PATCH] src: darwin/thread: reimplement monotonic clock for darwin

David Fuhrmann david.fuhrmann at gmail.com
Tue Dec 31 14:45:49 CET 2013

Am 31.12.2013 um 13:01 schrieb Rémi Denis-Courmont <remi at remlab.net>:

> Le mardi 31 décembre 2013, 12:30:31 David Fuhrmann a écrit :
>> Am 31.12.2013 um 12:19 schrieb Rémi Denis-Courmont <remi at remlab.net>:
>>> Le mardi 31 décembre 2013, 11:47:46 david.fuhrmann at gmail.com a écrit :
>>>> From: David Fuhrmann <david.fuhrmann at googlemail.com>
>>>> This is based on code which was silently removed in
>>>> 0f9a94f2183fc6c6e9ce8b77eb497aab160cbbbd and
>>>> 45c2bc0811cc2d9fe8e11448a05742d7ff6da1d8.
>>> This is based on code that silently broke condition variable clock
>>> selection and silently breaks clock selection back again.
>> I already told that you cannot do any "clock selection" on darwin.
> And that is why you cannot use any other clock.

Why do you think that I am trying to use any "other" clock?

After digging a lot into the documentation and Apples code, I am pretty certain that the clock used with mach_absolute_time is also the one used in the kernel.

gettimeofday is clearly not the right clock source, at least I did not got any timing issues with any other application when changing the system time. Just because pthread_cond_timedwait is expecting a value calculated out of gettimeofday, there is no reason to use this for the whole VLC. In fact, this value gets converted into a relative timeout again right at the beginning of this function.

And as I also wrote, nanosleep is using the same clock as I use in this patch.

If I am wrong, please point me to any Apple documentation saying so. 
But for now, I wish you a nice New Year's Eve and a happy new year. :-)

With best regards,

More information about the vlc-devel mailing list