Skip to content

Commit

Permalink
still cannot format error union
Browse files Browse the repository at this point in the history
  • Loading branch information
donpdonp committed Jul 12, 2024
1 parent e1bdf6d commit 6600741
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ const filter_lib = @import("./filter.zig");

var settings: config.Settings = undefined;

pub fn main() u8 {
pub fn main() !void {
hello();
initialize(alloc) catch unreachable;
thread.register_main_tid(thread.self()) catch unreachable;

if (config.readfile(config.config_file_path())) |_| {
// settings = config_data;
// const dummy_payload = alloc.create(thread.CommandVerb) catch unreachable;
// _ = thread.create("gui", gui.go, dummy_payload, guiback) catch unreachable;
// _ = thread.create("heartbeat", heartbeat.go, dummy_payload, heartback) catch unreachable;
if (config.readfile(config.config_file_path())) |config_data| {
settings = config_data;
const dummy_payload = alloc.create(thread.CommandVerb) catch unreachable;
_ = try thread.create("gui", gui.go, dummy_payload, guiback);
//_ = thread.create("heartbeat", heartbeat.go, dummy_payload, heartback) catch unreachable;

// while (true) {
// statewalk(alloc);
Expand All @@ -47,7 +47,6 @@ pub fn main() u8 {
} else |_| {
//log.err("config error: {!}\n", .{err});
}
return 0;
}

fn initialize(allocator: std.mem.Allocator) !void {
Expand Down
2 changes: 1 addition & 1 deletion src/thread.zig
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ pub fn signal(actor: *Actor, command: *Command) void {
//const command_address_bytes: *const [8]u8 = @ptrCast([*]const u8, command)[0..8]; // not OK
const command_address_bytes: *align(8) const [8]u8 = std.mem.asBytes(&command); // OK
//const command_address_bytes = std.mem.asBytes(&@as(usize, @ptrToInt(command))); // OK
warn("tid {} is signaling command {*} id {} {*} to thread.wait() \n", .{ actor.thread_id, command, command.id, command.verb });
//warn("tid {} is signaling command {*} id {} {*} to thread.wait() \n", .{ actor.thread_id, command, command.id, command.verb });
ipc.send(actor.client, command_address_bytes);
}

Expand Down

0 comments on commit 6600741

Please sign in to comment.