*changed fifo.read() to nb_read() which is non blocking and returns false if fifo is empty