+
+/**
+ * Setup Sensors, start Sensor polling thread(s)
+ */
+void Sensor_Spawn()
+{
+ // start sensor threads
+ for (int i = 0; i < NUMSENSORS; ++i)
+ {
+ Init(g_sensors+i, i);
+ pthread_create(&(g_sensors[i].thread), NULL, Sensor_Main, (void*)(g_sensors+i));
+ }
+}
+
+/**
+ * Quit Sensor loops
+ */
+void Sensor_Join()
+{
+ if (!Thread_Runstate())
+ {
+ Fatal("This function should not be called before Thread_QuitProgram");
+ }
+ for (int i = 0; i < NUMSENSORS; ++i)
+ {
+ pthread_join(g_sensors[i].thread, NULL);
+ Destroy(g_sensors+i);
+ }
+}