+static cgps_config_t cgps_config_data;
+
+static cgps_data_t cgps_data = {NAN, NAN, NAN, NAN};
+
+static pthread_t cgps_thread_id;
+static pthread_mutex_t cgps_data_lock = PTHREAD_MUTEX_INITIALIZER;
+static pthread_mutex_t cgps_thread_lock = PTHREAD_MUTEX_INITIALIZER;
+static int cgps_thread_shutdown = CGPS_FALSE;
+static int cgps_thread_running = CGPS_FALSE;
+
+/**
+ * Non blocking pause for the thread.
+ */
+static int cgps_thread_pause(cdtime_t pTime) {
+ cdtime_t now;
+ now = cdtime();
+ struct timespec pause_th;
+ CDTIME_T_TO_TIMESPEC(MS_TO_CDTIME_T(10), &pause_th);
+ while (CGPS_TRUE) {
+ if ((cdtime() - now) > pTime) {
+ break;
+ }