aboutsummaryrefslogtreecommitdiff
path: root/src/http/network_thread.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/network_thread.zig')
-rw-r--r--src/http/network_thread.zig25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/http/network_thread.zig b/src/http/network_thread.zig
new file mode 100644
index 000000000..d7f9c4409
--- /dev/null
+++ b/src/http/network_thread.zig
@@ -0,0 +1,25 @@
+const ThreadPool = @import("../thread_pool.zig");
+const Batch = ThreadPool.Batch;
+const std = @import("std");
+const AsyncIO = @import("io");
+
+const NetworkThread = @This();
+
+/// Single-thread in this pool
+pool: ThreadPool,
+
+pub var global: NetworkThread = undefined;
+pub var global_loaded: bool = false;
+
+pub fn init() !void {
+ AsyncIO.global = try AsyncIO.init(0, 0);
+ AsyncIO.global_loaded = true;
+
+ global = NetworkThread{
+ .pool = ThreadPool.init(.{ .max_threads = 1, .stack_size = 64 * 1024 * 1024 }),
+ };
+
+ global.pool.io = &AsyncIO.global;
+
+ global_loaded = true;
+}