mirror of
https://github.com/ziglang/zig.git
synced 2025-02-01 14:55:08 +00:00
std.os.linux: Replace @hasDecl()
with != void
check for VDSO.
If there is a VDSO, it will have clock_gettime(). The main thing we're concerned about is architectures that don't have a VDSO at all, of which there are a few.
This commit is contained in:
parent
624fa8523a
commit
d71076c982
@ -1399,7 +1399,7 @@ const VdsoClockGettime = *align(1) const fn (clockid_t, *timespec) callconv(.C)
|
||||
var vdso_clock_gettime: ?VdsoClockGettime = &init_vdso_clock_gettime;
|
||||
|
||||
pub fn clock_gettime(clk_id: clockid_t, tp: *timespec) usize {
|
||||
if (@hasDecl(VDSO, "CGT_SYM")) {
|
||||
if (VDSO != void) {
|
||||
const ptr = @atomicLoad(?VdsoClockGettime, &vdso_clock_gettime, .unordered);
|
||||
if (ptr) |f| {
|
||||
const rc = f(clk_id, tp);
|
||||
|
Loading…
Reference in New Issue
Block a user