renames
This commit is contained in:
parent
4c3945e874
commit
cc0ac66a18
|
@ -5,7 +5,7 @@ export fn serve() void {
|
||||||
const stdout_file = std.io.getStdOut().writer();
|
const stdout_file = std.io.getStdOut().writer();
|
||||||
var bw = std.io.bufferedWriter(stdout_file);
|
var bw = std.io.bufferedWriter(stdout_file);
|
||||||
const stdout = bw.writer();
|
const stdout = bw.writer();
|
||||||
stdout.print(" 0 ", .{}) catch unreachable;
|
stdout.print(" 2 ", .{}) catch unreachable;
|
||||||
bw.flush() catch unreachable;
|
bw.flush() catch unreachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
src/main.zig
16
src/main.zig
|
@ -9,7 +9,7 @@ const timeout = 250;
|
||||||
const Executor = struct {
|
const Executor = struct {
|
||||||
path: [:0]const u8,
|
path: [:0]const u8,
|
||||||
library: ?*anyopaque = null,
|
library: ?*anyopaque = null,
|
||||||
serve: ?serveFn = null,
|
serveFn: ?serveFn = null,
|
||||||
watch: ?usize = null,
|
watch: ?usize = null,
|
||||||
reload_lock: bool = false,
|
reload_lock: bool = false,
|
||||||
};
|
};
|
||||||
|
@ -43,7 +43,7 @@ fn serve() !void {
|
||||||
}
|
}
|
||||||
fn getExecutor(key: usize) !serveFn {
|
fn getExecutor(key: usize) !serveFn {
|
||||||
var executor = &executors[key];
|
var executor = &executors[key];
|
||||||
if (executor.serve) |s| return s;
|
if (executor.serveFn) |s| return s;
|
||||||
|
|
||||||
executor.library = blk: {
|
executor.library = blk: {
|
||||||
if (executor.library) |l|
|
if (executor.library) |l|
|
||||||
|
@ -64,11 +64,11 @@ fn getExecutor(key: usize) !serveFn {
|
||||||
};
|
};
|
||||||
|
|
||||||
// std.c.dlerror();
|
// std.c.dlerror();
|
||||||
const serve_function = std.c.dlsym(executor.library.?, SERVE_FN_NAME);
|
const serve_fn = std.c.dlsym(executor.library.?, SERVE_FN_NAME);
|
||||||
if (serve_function == null) return error.CouldNotLoadSymbolServe;
|
if (serve_fn == null) return error.CouldNotLoadSymbolServe;
|
||||||
|
|
||||||
executor.serve = @ptrCast(serveFn, serve_function.?);
|
executor.serveFn = @ptrCast(serveFn, serve_fn.?);
|
||||||
return executor.serve.?;
|
return executor.serveFn.?;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn executorChanged(watch: usize) void {
|
fn executorChanged(watch: usize) void {
|
||||||
|
@ -88,8 +88,8 @@ fn executorChanged(watch: usize) void {
|
||||||
log.warn("could not reload! error opening library", .{});
|
log.warn("could not reload! error opening library", .{});
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
executor.serve = @ptrCast(serveFn, std.c.dlsym(executor.library.?, SERVE_FN_NAME));
|
executor.serveFn = @ptrCast(serveFn, std.c.dlsym(executor.library.?, SERVE_FN_NAME));
|
||||||
if (executor.serve == null) {
|
if (executor.serveFn == null) {
|
||||||
log.warn("could not reload! error finding symbol", .{});
|
log.warn("could not reload! error finding symbol", .{});
|
||||||
if (std.c.dlclose(executor.library.?) != 0)
|
if (std.c.dlclose(executor.library.?) != 0)
|
||||||
@panic("System unstable: Error after library open and cannot close");
|
@panic("System unstable: Error after library open and cannot close");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user