Include: Fix command line parser hang when threaded.

This commit is contained in:
Wilson Snyder 2018-05-25 07:02:15 -04:00
parent e4e3294363
commit b1ab48b9fc
2 changed files with 2 additions and 1 deletions

View File

@ -1678,7 +1678,7 @@ void Verilated::flushCall() VL_MT_SAFE {
}
void Verilated::commandArgs(int argc, const char** argv) VL_MT_SAFE {
VerilatedLockGuard lock(m_mutex);
VerilatedLockGuard lock(s_args.m_argMutex);
s_args.argc = argc;
s_args.argv = argv;
VerilatedImp::commandArgs(argc,argv);

View File

@ -347,6 +347,7 @@ class Verilated {
// no need to be save-restored (serialized) the
// assumption is that the restore is allowed to pass different arguments
static struct CommandArgValues {
VerilatedMutex m_argMutex; ///< Mutex for s_args members, when VL_THREADED
int argc;
const char** argv;
CommandArgValues() : argc(0), argv(NULL) {}