Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Monitor causes thread to crash when having multiple threads #42

@Tehenauin

Description

@Tehenauin

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions