mirror of
https://github.com/rdmsr/zag.git
synced 2026-11-02 08:08:21 +00:00
ex: add console.write
This commit is contained in:
@@ -94,6 +94,19 @@ fn worker(_: ?*anyopaque) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn write(buf: []const u8) void {
|
||||||
|
console_lock.acquire();
|
||||||
|
|
||||||
|
var it = console_list.iterator();
|
||||||
|
|
||||||
|
while (it.next()) : (it.advance()) {
|
||||||
|
const console: *Console = @fieldParentPtr("link", it.get());
|
||||||
|
console.write(console.ctx, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
console_lock.release();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn register(cons: *Console) void {
|
pub fn register(cons: *Console) void {
|
||||||
// Drain all logs until now.
|
// Drain all logs until now.
|
||||||
_ = drain_from_on(0, cons);
|
_ = drain_from_on(0, cons);
|
||||||
|
|||||||
@@ -12,4 +12,5 @@ pub const workqueue = struct {
|
|||||||
|
|
||||||
pub const console = struct {
|
pub const console = struct {
|
||||||
pub const register = p.console.register;
|
pub const register = p.console.register;
|
||||||
|
pub const write = p.console.write;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user