1
0
Fork 0

lock the data mutex for the minimum necessary instructions

This commit is contained in:
Kevin Matz 2022-11-23 13:42:49 -05:00
parent da668011fe
commit e157090e35
1 changed files with 3 additions and 2 deletions

View File

@ -496,7 +496,9 @@ void Universe::tx_loop_()
// see if this is new data or re-transmitting
auto sleep = std::chrono::milliseconds(minimum_update_time);
null_start_mutex.lock();
if (null_start_data != last_null_data)
bool new_data = (null_start_data != last_null_data);
null_start_mutex.unlock();
if (new_data)
{
retransmission_count = 0;
last_null_data = null_start_data;
@ -504,7 +506,6 @@ void Universe::tx_loop_()
else
if (++retransmission_count >= 2)
sleep = std::chrono::milliseconds(keep_alive_interval);
null_start_mutex.unlock();
// send the sACN message
sACNsend();