Hi Nicolai, On 22 October 2017 at 20:07, Nicolai Hähnle <nhaeh...@gmail.com> wrote: > From: Nicolai Hähnle <nicolai.haeh...@amd.com> > > C11 threads were changed to use struct timespec instead of xtime, and > thrd_sleep got a second argument. > As xtime was replaced with timespec there's a couple of odd bits in the code.
> See http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1554.htm and > http://en.cppreference.com/w/c/thread/{thrd_sleep,cnd_timedwait,mtx_timedlock} > > Note that cnd_timedwait is spec'd to be relative to TIME_UTC / CLOCK_REALTIME. > > Cc: Jose Fonseca <jfons...@vmware.com> > --- > include/c11/threads.h | 11 ----------- > include/c11/threads_posix.h | 39 +++++++++++++++------------------------ > include/c11/threads_win32.h | 37 +++++++++++++++++++------------------ > src/egl/drivers/dri2/egl_dri2.c | 24 +++++++++++++----------- > 4 files changed, 47 insertions(+), 64 deletions(-) > > diff --git a/include/c11/threads.h b/include/c11/threads.h > index 573348d8091..3c3f23a8ab8 100644 > --- a/include/c11/threads.h > +++ b/include/c11/threads.h > @@ -23,42 +23,31 @@ > * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT > * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE > * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR > OTHERWISE, > * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR > OTHER > * DEALINGS IN THE SOFTWARE. > */ > #ifndef EMULATED_THREADS_H_INCLUDED_ > #define EMULATED_THREADS_H_INCLUDED_ > > #include <time.h> > -#ifdef _MSC_VER > -#include <thr/xtimec.h> // for xtime > -#endif > > #ifndef TIME_UTC > #define TIME_UTC 1 > #endif > > #include "c99_compat.h" /* for `inline` */ > > /*---------------------------- types ----------------------------*/ > typedef void (*tss_dtor_t)(void*); > typedef int (*thrd_start_t)(void*); > > -#ifndef _MSC_VER > -struct xtime { > - time_t sec; > - long nsec; > -}; > -typedef struct xtime xtime; > -#endif > - We don't have a fall-back declaration of the struct, yet we use it below and provide a timespec_get() implementation. I'd imagine you haven't tested this on Windows (hence Jose in CC)? Quick search suggests that MSVC 2015 was the first one that introduces the struct and timespec_get. If we're safe as-is, please add a comment with some details - I'd imagine Jose had better knowledge in the area. > /*-------------------- 7.25.7 Time functions --------------------*/ > // 7.25.6.1 > +#if 0 I'd just drop the hunk mentioning that timespec_get() is part of time.h Thank Emil _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev