I have 2 OSC servers, that receive messages with the same adress from different ports. Every time I started the application, one of the threads was stopping to work after a while. I found out, that it has something to do with the string builder, that throws an exception when 2 threads are trying to access it at the same time.
my simple but ugly solution for this is adding a _logging bool to the monitor class and wrapping the content of the MonitorCallback method in
if (_logging) return;
_logging = true;
...
_logging = false;
This way the monitor does not start a new log when already logging. It does also mean that some messages do not get logged tho. But I am fine with that. Of Course some kind of queue would probably be nicer here.
I have 2 OSC servers, that receive messages with the same adress from different ports. Every time I started the application, one of the threads was stopping to work after a while. I found out, that it has something to do with the string builder, that throws an exception when 2 threads are trying to access it at the same time.
my simple but ugly solution for this is adding a
_logging
bool to the monitor class and wrapping the content of the MonitorCallback method inThis way the monitor does not start a new log when already logging. It does also mean that some messages do not get logged tho. But I am fine with that. Of Course some kind of queue would probably be nicer here.