Skip to content

Commit cd21c01

Browse files
authored
oscpack / udpSocket: invert the "break_" semaphore (#7963)
#changelog #addon
1 parent a2c9d73 commit cd21c01

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

addons/ofxOsc/libs/oscpack/src/ip/posix/UdpSocket.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,8 @@ class SocketReceiveMultiplexer::Implementation{
356356
std::vector< std::pair< PacketListener*, UdpSocket* > > socketListeners_;
357357
std::vector< AttachedTimerListener > timerListeners_;
358358

359-
volatile bool break_;
359+
std::atomic<bool> break_ = false;
360+
360361
int breakPipe_[2]; // [0] is the reader descriptor and [1] the writer
361362

362363
double GetCurrentTimeMs() const
@@ -423,7 +424,6 @@ class SocketReceiveMultiplexer::Implementation{
423424

424425
void Run()
425426
{
426-
break_ = false;
427427
char *data = 0;
428428

429429
try{
@@ -540,11 +540,16 @@ class SocketReceiveMultiplexer::Implementation{
540540
}
541541

542542
delete [] data;
543+
break_ = false;
544+
543545
}catch(...){
544546
if( data )
545547
delete [] data;
548+
break_ = false;
549+
546550
throw;
547551
}
552+
548553
}
549554

550555
void Break()

0 commit comments

Comments
 (0)