• Mike Appleby's avatar
    runtime: sleep on CLOCK_MONOTONIC in futexsleep1 on freebsd · 360f2e43
    Mike Appleby authored
    In FreeBSD 10.0, the _umtx_op syscall was changed to allow sleeping on
    any supported clock, but the default clock was switched from a monotonic
    clock to CLOCK_REALTIME.
    
    Prior to 10.0, the __umtx_op_wait* functions ignored the fourth argument
    to _umtx_op (uaddr1), expected the fifth argument (uaddr2) to be a
    struct timespec pointer, and used a monotonic clock (nanouptime(9)) for
    timeout calculations.
    
    Since 10.0, if callers want a clock other than CLOCK_REALTIME, they must
    call _umtx_op with uaddr1 set to a value greater than sizeof(struct
    timespec), and with uaddr2 as pointer to a struct _umtx_time, rather
    than a timespec. Callers can set the _clockid field of the struct
    _umtx_time to request the clock they want.
    
    The relevant FreeBSD commit:
        https://svnweb.freebsd.org/base?view=revision&revision=232144
    
    Fixes #17168
    
    Change-Id: I3dd7b32b683622b8d7b4a6a8f9eb56401bed6bdf
    Reviewed-on: https://go-review.googlesource.com/30154Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
    Run-TryBot: Ian Lance Taylor <iant@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    360f2e43
defs_freebsd.go 2.96 KB