+/**
+ * @function BeforeDraw
+ * @purpose Called in graphics thread before the draw loop
+ * When --pedantic-graphics enabled, will wait for position computations to finish before drawing
+ * Otherwise does nothing
+ */
+void BeforeDraw()
+{
+ if (!options.pedantic_graphics)
+ return;
+ pthread_mutex_lock(&mutex_graphics);
+ while (!graphics_busy)
+ pthread_cond_wait(&graphics_cv, &mutex_graphics);
+ pthread_mutex_unlock(&mutex_graphics);
+}
+
+/**
+ * @function AfterDraw
+ * @purpose Called in graphics thread after the draw loop
+ * When --pedantic-graphics is supplied, will signal computation thread that drawing is finished
+ * So that positions can be safely altered
+ * Otherwise does nothing
+ */
+void AfterDraw()
+{
+ if (!options.pedantic_graphics)
+ return;
+ pthread_mutex_lock(&mutex_graphics);
+ graphics_busy = false;
+ pthread_cond_signal(&graphics_cv);
+ pthread_mutex_unlock(&mutex_graphics);
+}
+