My app processes incoming serial bluetooth data in a foreground service.
The NewData sub event handler is defined in the service module.
It looks like when there is a massive amount of incoming data, the whole app freeze.
I suspect the culprit is the NewData event processing, that called repeatedly under load.
I already tried adding a Sleep(0) in the NewData sub, with no different result.
How can I give back control to main thread to be sure the app is not marked as not responding?
The NewData sub event handler is defined in the service module.
It looks like when there is a massive amount of incoming data, the whole app freeze.
I suspect the culprit is the NewData event processing, that called repeatedly under load.
I already tried adding a Sleep(0) in the NewData sub, with no different result.
How can I give back control to main thread to be sure the app is not marked as not responding?