What I would do in your shoes is perform your gpsd polling loop in a thread
with a mutex lock/release wrapping the read,
This is what I am doing now in order to read the client buffer as fast as possible.
then use the same mutex
to ensure that you only look at the client buffer while it's
quiescent. If the PACKET_SET bit is on in gpsdata->set when the
buffer is quiescent, you know you have a whole packet to look at.
However I did not need this. Simply, as I work with C++ classes, I save the
NMEA fields of interest in some object's member variables and then read them from
other thread once per second.
Cheers,
Pablo