Skip to content

Commit 813e861

Browse files
authored
Merge pull request #25817 from castholm/windows-fetch
Fix TLS, `io.async()` and package fetching on Windows
2 parents 375d873 + 8887346 commit 813e861

File tree

3 files changed

+194
-94
lines changed

3 files changed

+194
-94
lines changed

lib/std/Io.zig

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -734,16 +734,19 @@ pub const Clock = enum {
734734
/// A settable system-wide clock that measures real (i.e. wall-clock)
735735
/// time. This clock is affected by discontinuous jumps in the system
736736
/// time (e.g., if the system administrator manually changes the
737-
/// clock), and by frequency adjust‐ ments performed by NTP and similar
737+
/// clock), and by frequency adjustments performed by NTP and similar
738738
/// applications.
739739
///
740740
/// This clock normally counts the number of seconds since 1970-01-01
741741
/// 00:00:00 Coordinated Universal Time (UTC) except that it ignores
742742
/// leap seconds; near a leap second it is typically adjusted by NTP to
743743
/// stay roughly in sync with UTC.
744744
///
745-
/// The epoch is implementation-defined. For example NTFS/Windows uses
746-
/// 1601-01-01.
745+
/// Timestamps returned by implementations of this clock represent time
746+
/// elapsed since 1970-01-01T00:00:00Z, the POSIX/Unix epoch, ignoring
747+
/// leap seconds. This is colloquially known as "Unix time". If the
748+
/// underlying OS uses a different epoch for native timestamps (e.g.,
749+
/// Windows, which uses 1601-01-01) they are translated accordingly.
747750
real,
748751
/// A nonsettable system-wide clock that represents time since some
749752
/// unspecified point in the past.
@@ -990,15 +993,15 @@ pub fn Future(Result: type) type {
990993
/// Idempotent. Not threadsafe.
991994
pub fn cancel(f: *@This(), io: Io) Result {
992995
const any_future = f.any_future orelse return f.result;
993-
io.vtable.cancel(io.userdata, any_future, @ptrCast((&f.result)[0..1]), .of(Result));
996+
io.vtable.cancel(io.userdata, any_future, @ptrCast(&f.result), .of(Result));
994997
f.any_future = null;
995998
return f.result;
996999
}
9971000

9981001
/// Idempotent. Not threadsafe.
9991002
pub fn await(f: *@This(), io: Io) Result {
10001003
const any_future = f.any_future orelse return f.result;
1001-
io.vtable.await(io.userdata, any_future, @ptrCast((&f.result)[0..1]), .of(Result));
1004+
io.vtable.await(io.userdata, any_future, @ptrCast(&f.result), .of(Result));
10021005
f.any_future = null;
10031006
return f.result;
10041007
}
@@ -1034,7 +1037,7 @@ pub const Group = struct {
10341037
@call(.auto, function, args_casted.*);
10351038
}
10361039
};
1037-
io.vtable.groupAsync(io.userdata, g, @ptrCast((&args)[0..1]), .of(Args), TypeErased.start);
1040+
io.vtable.groupAsync(io.userdata, g, @ptrCast(&args), .of(Args), TypeErased.start);
10381041
}
10391042

10401043
/// Blocks until all tasks of the group finish. During this time,
@@ -1111,7 +1114,7 @@ pub fn Select(comptime U: type) type {
11111114
}
11121115
};
11131116
_ = @atomicRmw(usize, &s.outstanding, .Add, 1, .monotonic);
1114-
s.io.vtable.groupAsync(s.io.userdata, &s.group, @ptrCast((&args)[0..1]), .of(Args), TypeErased.start);
1117+
s.io.vtable.groupAsync(s.io.userdata, &s.group, @ptrCast(&args), .of(Args), TypeErased.start);
11151118
}
11161119

11171120
/// Blocks until another task of the select finishes.
@@ -1539,9 +1542,9 @@ pub fn async(
15391542
var future: Future(Result) = undefined;
15401543
future.any_future = io.vtable.async(
15411544
io.userdata,
1542-
@ptrCast((&future.result)[0..1]),
1545+
@ptrCast(&future.result),
15431546
.of(Result),
1544-
@ptrCast((&args)[0..1]),
1547+
@ptrCast(&args),
15451548
.of(Args),
15461549
TypeErased.start,
15471550
);
@@ -1580,7 +1583,7 @@ pub fn concurrent(
15801583
io.userdata,
15811584
@sizeOf(Result),
15821585
.of(Result),
1583-
@ptrCast((&args)[0..1]),
1586+
@ptrCast(&args),
15841587
.of(Args),
15851588
TypeErased.start,
15861589
);

0 commit comments

Comments
 (0)