aboutsummaryrefslogtreecommitdiff
path: root/src/thread_pool.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-07-11 19:14:34 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-11 19:14:34 -0700
commitcbb88672f217a90db1aa1eb29cd92d5d9035b22b (patch)
tree43a00501f3cde495967e116f0b660777051551f8 /src/thread_pool.zig
parent1f900cff453700b19bca2acadfe26da4468c1282 (diff)
parent34b0e7a2bbd8bf8097341cdb0075d0908283e834 (diff)
downloadbun-jarred/esm-conditions.tar.gz
bun-jarred/esm-conditions.tar.zst
bun-jarred/esm-conditions.zip
Merge branch 'main' into jarred/esm-conditionsjarred/esm-conditions
Diffstat (limited to 'src/thread_pool.zig')
-rw-r--r--src/thread_pool.zig12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/thread_pool.zig b/src/thread_pool.zig
index b6e766cf9..3359311d6 100644
--- a/src/thread_pool.zig
+++ b/src/thread_pool.zig
@@ -59,8 +59,8 @@ pub const Config = struct {
/// Statically initialize the thread pool using the configuration.
pub fn init(config: Config) ThreadPool {
return .{
- .stack_size = std.math.max(1, config.stack_size),
- .max_threads = std.math.max(1, config.max_threads),
+ .stack_size = @max(1, config.stack_size),
+ .max_threads = @max(1, config.max_threads),
};
}
@@ -945,11 +945,11 @@ pub const Node = struct {
var stack = self.stack.load(.Monotonic);
while (true) {
// Attach the list to the stack (pt. 1)
- list.tail.next = @intToPtr(?*Node, stack & PTR_MASK);
+ list.tail.next = @ptrFromInt(?*Node, stack & PTR_MASK);
// Update the stack with the list (pt. 2).
// Don't change the HAS_CACHE and IS_CONSUMING bits of the consumer.
- var new_stack = @ptrToInt(list.head);
+ var new_stack = @intFromPtr(list.head);
assert(new_stack & ~PTR_MASK == 0);
new_stack |= (stack & ~PTR_MASK);
@@ -985,7 +985,7 @@ pub const Node = struct {
new_stack,
.Acquire,
.Monotonic,
- ) orelse return self.cache orelse @intToPtr(*Node, stack & PTR_MASK);
+ ) orelse return self.cache orelse @ptrFromInt(*Node, stack & PTR_MASK);
}
}
@@ -1022,7 +1022,7 @@ pub const Node = struct {
assert(stack & IS_CONSUMING != 0);
assert(stack & PTR_MASK != 0);
- const node = @intToPtr(*Node, stack & PTR_MASK);
+ const node = @ptrFromInt(*Node, stack & PTR_MASK);
consumer_ref.* = node.next;
return node;
}