shithub: mc

ref: 537313ee9a2179cc6e869c6e8c70da4af1f07f28
dir: /lib/thread/test/waitgrp.myr/

View raw version
use std
use thread

const Threadc = 8

var wg

const main = {
	wg = thread.mkwg(Threadc)

	for var i = 0; i < Threadc; i++
		thread.spawn({
			std.usleep(3_000_000)
			thread.wgpost(&wg)
			thread.wgwait(&wg)
		})
	;;
	thread.wgwait(&wg)
}