Added thread_wait_for_count() which allows the menu to wait for all (new) threads to
exit before continuing. We need this for khu testing because we have to make sure cleanup is done before getting the used byte count.
This commit is contained in:
@@ -117,6 +117,7 @@ common_prog(int nargs, char **args)
|
||||
{
|
||||
struct proc *proc;
|
||||
int result;
|
||||
unsigned tc;
|
||||
|
||||
/* Create a process for the new program to run in. */
|
||||
proc = proc_create_runprogram(args[0] /* name */);
|
||||
@@ -124,6 +125,8 @@ common_prog(int nargs, char **args)
|
||||
return ENOMEM;
|
||||
}
|
||||
|
||||
tc = thread_count;
|
||||
|
||||
result = thread_fork(args[0] /* thread name */,
|
||||
proc /* new process */,
|
||||
cmd_progthread /* thread function */,
|
||||
@@ -139,6 +142,10 @@ common_prog(int nargs, char **args)
|
||||
* once you write the code for handling that.
|
||||
*/
|
||||
|
||||
// Wait for all threads to finish cleanup, otherwise khu be a bit behind,
|
||||
// especially once swapping is enabled.
|
||||
thread_wait_for_count(tc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user