public void add_message(Message msg) { this.comms_q.Enqueue(msg); }
public void run() { while (run_th) { if (comms_q.Count > 0) { messg = comms_q.Dequeue(); switch (messg.GetRequest()) { case Message.MsgRequest.FIND_DEVICES: find_devices(); break; case Message.MsgRequest.CONNECT_DEVICE: connect_device(messg.GetMessage()); break; } } Thread.Sleep(10); } }