Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Monitor causes thread to crash when having multiple threads #42

Open
Tehenauin opened this issue Mar 21, 2023 · 1 comment
Open

Monitor causes thread to crash when having multiple threads #42

Tehenauin opened this issue Mar 21, 2023 · 1 comment
Assignees

Comments

@Tehenauin
Copy link

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.

@keijiro keijiro self-assigned this Mar 21, 2023
@Tehenauin
Copy link
Author

It seems, that my solution doesnt work completely, it can still happen, just not as often as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants