aboutsummaryrefslogtreecommitdiff
path: root/std/event.zig
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2018-07-07 01:23:18 -0400
committerAndrew Kelley <superjoe30@gmail.com>2018-07-07 01:23:18 -0400
commitc15a6fa9d0e11398f65e8ecc1903e07f4c57add6 (patch)
tree556306ecdb10cf6841b488e6950e49d2db92005c /std/event.zig
parent57f36c420124b3b65d3036f10c4e8c675be29cf4 (diff)
downloadzig-c15a6fa9d0e11398f65e8ecc1903e07f4c57add6.tar.gz
zig-c15a6fa9d0e11398f65e8ecc1903e07f4c57add6.zip
add std.os.cpuCount and have std.event.Loop use it for thread pool size
Diffstat (limited to 'std/event.zig')
-rw-r--r--std/event.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/std/event.zig b/std/event.zig
index 5fd87b8fdd..f0c45f61bc 100644
--- a/std/event.zig
+++ b/std/event.zig
@@ -150,8 +150,8 @@ pub const Loop = struct {
/// TODO copy elision / named return values so that the threads referencing *Loop
/// have the correct pointer value.
fn initMultiThreaded(self: *Loop, allocator: *mem.Allocator) !void {
- // TODO check the actual cpu core count
- return self.initInternal(allocator, 4);
+ const core_count = try std.os.cpuCount(allocator);
+ return self.initInternal(allocator, core_count);
}
/// Thread count is the total thread count. The thread pool size will be