Don't lock the mutex before calling netstatusGetDetails, lock it afterwards and use tmp fields.

This commit is contained in:
yellows8 2019-06-25 16:21:30 -04:00
parent f0ef77b2f2
commit 753a97ef7b
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43

View File

@ -18,6 +18,8 @@ static int statusThreadProc(void* unused)
mtx_lock(&s_statusMtx); mtx_lock(&s_statusMtx);
struct timespec timeout = {0}; struct timespec timeout = {0};
bool tmpflag;
AssetId tmpid;
clock_gettime(CLOCK_MONOTONIC, &timeout); clock_gettime(CLOCK_MONOTONIC, &timeout);
timeout.tv_sec++; timeout.tv_sec++;
@ -29,9 +31,12 @@ static int statusThreadProc(void* unused)
if (s_statusExit) if (s_statusExit)
break; break;
tmpflag = netstatusGetDetails(&tmpid);
mtx_lock(&s_statusAccessMtx); mtx_lock(&s_statusAccessMtx);
s_statusNetFlag = netstatusGetDetails(&s_statusNetAssetId); s_statusNetFlag = tmpflag;
s_statusNetAssetId = tmpid;
s_statusReady = 1; s_statusReady = 1;