volatile bools work, but just know that every time you check it you are
doing a non-cached memory read (relatively slow). It can't read from the
cache/registers (much faster) because other threads/processes are allowed
to modify it at any time (and when they do, they don't/can't modify the
cached/in-register copy). I used to use volatile bools in a similar fashion
before I discovered Qt... but Qt provides much better ways for managing
threads.

If you only need to read from the serial port periodically, you can set
your backend up like I did for backend2 in the exampe... which also uses a
timer.

....but if it ain't broke, don't fix it...

d3fault
_______________________________________________
Development mailing list
Development@qt-project.org
http://lists.qt-project.org/mailman/listinfo/development

Reply via email to