mirror of
https://github.com/ziglang/zig.git
synced 2025-12-06 22:33:08 +00:00
riscv: workarounds for riscv threading
This commit is contained in:
parent
a7498a6a53
commit
c20def73af
@ -385,7 +385,7 @@ pub fn yield() YieldError!void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// State to synchronize detachment of spawner thread to spawned thread
|
/// State to synchronize detachment of spawner thread to spawned thread
|
||||||
const Completion = std.atomic.Value(enum(u8) {
|
const Completion = std.atomic.Value(enum(if (builtin.zig_backend == .stage2_riscv64) u32 else u8) {
|
||||||
running,
|
running,
|
||||||
detached,
|
detached,
|
||||||
completed,
|
completed,
|
||||||
|
|||||||
@ -34,20 +34,6 @@ fn alloc(_: *anyopaque, n: usize, log2_align: u8, ra: usize) ?[*]u8 {
|
|||||||
return @ptrCast(addr);
|
return @ptrCast(addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (builtin.zig_backend == .stage2_riscv64) {
|
|
||||||
const aligned_len = mem.alignForward(usize, n, mem.page_size);
|
|
||||||
const slice = posix.mmap(
|
|
||||||
null,
|
|
||||||
aligned_len,
|
|
||||||
posix.PROT.READ | posix.PROT.WRITE,
|
|
||||||
.{ .TYPE = .PRIVATE, .ANONYMOUS = true },
|
|
||||||
-1,
|
|
||||||
0,
|
|
||||||
) catch return null;
|
|
||||||
assert(mem.isAligned(@intFromPtr(slice.ptr), mem.page_size));
|
|
||||||
return slice.ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
const aligned_len = mem.alignForward(usize, n, mem.page_size);
|
const aligned_len = mem.alignForward(usize, n, mem.page_size);
|
||||||
const hint = @atomicLoad(@TypeOf(std.heap.next_mmap_addr_hint), &std.heap.next_mmap_addr_hint, .unordered);
|
const hint = @atomicLoad(@TypeOf(std.heap.next_mmap_addr_hint), &std.heap.next_mmap_addr_hint, .unordered);
|
||||||
const slice = posix.mmap(
|
const slice = posix.mmap(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user