-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.
Description
Describe the bug
I have this code snippet
pub fn run_batches(targets []Target, batches [][]string) ! {
mut name_to_cmds := map[string][]string{}
for t in targets {
name_to_cmds[t.name] = t.cmds.clone()
}
for batch in batches {
mut threads := []thread !string{}
for name in batch {
cmds := name_to_cmds[name].clone()
threads << spawn exec_node_concurrent(name, cmds)
}
for mut t in threads {
res := t.wait() or { return error(err.str()) }
println(res)
}
}
}
fn exec_node_concurrent(name string, cmd_list []string) !string {
for cmd in cmd_list {
println('${name}: executing command "${cmd}"')
res := os.execute(cmd)
if res.exit_code != 0 {
return error('command failed (exit ' + res.exit_code.str() + '): ' + cmd)
}
}
return 'target "${name}" executed successfully'
}
when I run it gives me this:
Reproduction Steps
here is the full code: https://github.com/SalmaElsoly/vmake/blob/master/src/vmake/runner.v
run with -p to run using threads
Expected Behavior
runs normally as the series one
Current Behavior
it runs in series without using threads when I add threads it doesn't run
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.12 6a590f1,
Environment details (OS name and version, etc.)
linux, Ubuntu 24.04.3 LTS
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
xmonader
Metadata
Metadata
Assignees
Labels
BugThis tag is applied to issues which reports bugs.This tag is applied to issues which reports bugs.