c - synchronisation issue within callback functions -
in continuous loop barcodes scanned , if scan valid text data , voice data read out/played, happens in differnt context. text playback happens first, callback function gets executed, there voice playback happens, , callback function. issue seen when multiple scanning done, there synchronisation issues. while text playback of 1st barcode happening, if scan done, voice data of 2nd barcode gets played(skipping text playback of 2nd). behaviour observed sometimes, kind of difficult debug.
any ideas how provide synchronisation within callbacks?
thanks in advance help.
-aparna
your question isn't clear lets assume have 3 threads
- reads barcode hardware
- displays code?
- audio playback of code text contained in barcode
the thread reading barcode producer of data , should push work unit onto consumer stack , should notify stack there work unit. run cursory google search producer-consumer queue.
threads 2 & 3 appear synchronous , should combined single thread?
Comments
Post a Comment