mirror of
https://github.com/jetzig-framework/jetzig.git
synced 2025-05-14 14:06:08 +00:00
Merge pull request #169 from blurrycat/fix/thread_anon_struct
Fix anonymous struct literal in log_thread spawn
This commit is contained in:
commit
b8af924f8e
@ -62,7 +62,7 @@ pub fn start(self: *const App, routes_module: type, options: AppOptions) !void {
|
||||
var log_thread = try std.Thread.spawn(
|
||||
.{ .allocator = self.allocator },
|
||||
jetzig.loggers.LogQueue.Reader.publish,
|
||||
.{ &self.env.log_queue.reader, .{} },
|
||||
.{ &self.env.log_queue.reader, jetzig.loggers.LogQueue.Reader.PublishOptions{} },
|
||||
);
|
||||
defer log_thread.join();
|
||||
|
||||
|
@ -147,9 +147,13 @@ pub const Reader = struct {
|
||||
stderr_file: std.fs.File,
|
||||
queue: *LogQueue,
|
||||
|
||||
pub const PublishOptions = struct {
|
||||
oneshot: bool = false,
|
||||
};
|
||||
|
||||
/// Publish log events from the queue. Invoke from a dedicated thread. Sleeps when log queue
|
||||
/// is empty, wakes up when a new event is published.
|
||||
pub fn publish(self: *Reader, options: struct { oneshot: bool = false }) !void {
|
||||
pub fn publish(self: *Reader, options: PublishOptions) !void {
|
||||
std.debug.assert(self.queue.state == .ready);
|
||||
|
||||
const stdout_writer = self.stdout_file.writer();
|
||||
|
Loading…
x
Reference in New Issue
Block a user