added locking to get_request in lua scripting

This commit is contained in:
Espina
2016-05-30 11:52:17 -07:00
parent c8b7d30619
commit 343664e950

View File

@ -241,15 +241,18 @@ sb_request_t sb_lua_get_request(int thread_id)
(void) thread_id; /* unused */
SB_THREAD_MUTEX_LOCK();
if (sb_globals.max_requests != 0 && nevents >= sb_globals.max_requests)
{
req.type = SB_REQ_TYPE_NULL;
SB_THREAD_MUTEX_UNLOCK();
return req;
}
req.type = SB_REQ_TYPE_SCRIPT;
nevents++;
SB_THREAD_MUTEX_UNLOCK();
return req;
}