title: How to wait for a barcode reader input without freezing the main thread of my program?
body: <p>i'm writing a program using C++ that finds an object on a video, then the user must scan, with a barcode reader, some code in a list, then if the code is correct, the information is sent to a table in MySql.</p>
  
  <p>i am stuck in the part of waiting for the user to scan the barcode. if i use a loop then the program gets frezed, so maybe i must wait for some keyboard event(because the barcode behaves like it), but this function can't continue if the code hasn't been readed.</p>
  
  <p>so any one can point me what is the best way to do it?..</p>