Retour au cours

Concurrence : Threads

Cours complet : Programmation Zig de Zéro à Héros

Multi-threading

Zig fournit un moyen standard de créer et de gérer des threads système (OS).

zig fn work(id: u32) void { std.debug.print("Le thread {d} travaille\n", .{id}); }

pub fn main() !void { const thread = try std.Thread.spawn(.{}, work, .{1}); thread.join(); }