I am not sure how to handle asynchronous tasks in the program that I am writing, and I hope that someone more experienced can at least point me in the right direction.
I am running Angstrom Linux on an embedded ARM processor. My program controls several servos through the open hardware PWM and the camera through PTP. It is also a socket daemon that accepts commands from an arbitrary client (Android in this case). The PTP camera is slow, and I do not want to wait until it finishes its task, because the rest of the program must be responsive.
I tried the threads, but any problems in the camera stream seem to kill the whole process. Ideally, I want to send the camera on my own to do my thing, and when it is ready, let the main function know. Is this a suitable branching technique or am I threading incorrectly?
In addition, I would like to stay away from large secondary libraries to avoid any cross-compilation problems than I already have. Thanks in advance for any suggestions.
source share