I am using a thread to send UDP datagrams every 4 audio blocks.
- I would implement this by starting a thread every 4 audio blocks, the thread would send the datagram and exit.
- Alternatively, I could have a while loop in the run() method of the thread always running (and sleeping) in the background, which would send the datagram whenever a given flag is set.
I would prefer the first approach, unless there is any noticeable overhead in calling startThread() and exiting the thread every time.
Is there any overhead associated with startThread() ?