[Merkaartor] Refactoring GPS/ directory

bvh bvh-osm at irule.be
Mon Sep 8 09:42:59 BST 2008


On Mon, Sep 08, 2008 at 10:45:03AM +0200, Chris Browet wrote:
> > win_extserialport.cpp should launch another thread that does a
> > (blocking) WaitCommEvent on the serial port and emits the signal. That
> > is quickly getting messy though.
> That would be the proper thing to do, but is a bit ridiculous, IMHO.

I agree.

> > Easier is to revert those changes (just that revision please) and
> > add a sleep in the loop to make sure that the thread is not
> > permanently hogging cpu. It is not as good, but will still help
> > batterylife.
> > I re-added the polling in the slot forwarding class via a timer (500ms).
> Works fine, AFAIK and does not hurt CPU.

Just saw your commit. Good fix there. The only slight worry I have is
the fact that QextSerialPort gets created in the main thread and deleted
in the worker thread. The Qt documentation says this is 'unsafe unless
you can guarantee that the object isn't processing events at the same
moment'. They advice to use QObject::deleteLater() instead. Do you think
that is necessary?

cu bart




More information about the Merkaartor mailing list