-
Notifications
You must be signed in to change notification settings - Fork 6
zigar.thread.WorkQueue(ns).Promisified(func) ᴾᴴᴾ
Chung Leong edited this page Jul 19, 2026
·
1 revision
JavaScript | PHP
Return a function type that has same arguments as the given function with the addition of either a Promise.
You generally don't need to use this function directly.
Usage
const std = @import("std");
const zigar = @import("zigar");
pub fn printTypeNames() void {
const T1 = zigar.thread.WorkQueue(ns).Promisified(ns.hello);
const T2 = zigar.thread.WorkQueue(ns).Promisified(.shutdown);
std.debug.print("{s}\n", .{@typeName(T1)});
std.debug.print("{s}\n", .{@typeName(T2)});
}
const ns = struct {
pub fn hello() void {
std.Thread.sleep(500 * 1000000); // pause for half a second
std.debug.print("Hello, world!", .{});
}
};<?php
$m = zigar_use(__DIR__ . '/work-queue-example-9.zig');
$m->printTypeNames();fn (type.promise.Promise(void)) error{OutOfMemory,Unexpected}!void
fn (type.promise.Promise(void)) void
Arguments:
-
func:anytype
A function or enum literal.
Return value:
type