shithub: tinygl

Download patch

ref: 3dd6408be369a236d691e9c25c80789caedc2937
parent: 12e35848c7536a49fec91dc6b54a715977352d65
author: David <gek@katherine>
date: Fri Mar 5 20:47:34 EST 2021

Automatic commit.

--- a/SDL_Examples/include/lockstepthread.h
+++ b/SDL_Examples/include/lockstepthread.h
@@ -10,7 +10,7 @@
 #ifndef LOCKSTEPTHREAD_H
 #define LOCKSTEPTHREAD_H
 #include <pthread.h>
-#include <stdio.h>
+#include <stdlib.h>
 typedef struct {
 	pthread_mutex_t myMutex;
 	pthread_barrier_t myBarrier;
@@ -18,7 +18,8 @@
 	int isThreadLive;
 	int shouldKillThread;
 	int state;
-	void (*execute)();
+	void (*execute)(void*);
+	void* argument;
 } lsthread;
 void init_lsthread(lsthread* t);
 void start_lsthread(lsthread* t);
@@ -37,6 +38,7 @@
 	t->shouldKillThread = 0;
 	t->state = 0;
 	t->execute = NULL;
+	t->argument = NULL;
 }
 void destroy_lsthread(lsthread* t){
 	pthread_mutex_destroy(&t->myMutex);
@@ -95,7 +97,7 @@
 		//exit(1)
 		//if(ret)pthread_exit(NULL);
 		if (!(me->shouldKillThread) && me->execute)
-			me->execute();
+			me->execute(me->argument);
 		else if(me->shouldKillThread){
 			pthread_mutex_unlock(&me->myMutex);
 			//exit(1)