|
@@ -20,7 +20,11 @@ extern Game game[MAXGAME];
|
|
|
extern int nbGame;
|
|
|
|
|
|
/* --- Fonctions privées --- */
|
|
|
-
|
|
|
+/**
|
|
|
+ * Thread d'attente de la fonction timer
|
|
|
+ * @param void* La structure timer_data cast en void*
|
|
|
+ * @return NULL
|
|
|
+ */
|
|
|
void* timer_thread(void* data){
|
|
|
timer_data* t;
|
|
|
//Recup données
|
|
@@ -39,6 +43,13 @@ void* timer_thread(void* data){
|
|
|
return NULL;
|
|
|
}
|
|
|
|
|
|
+/**
|
|
|
+ * Attend X second (sans bloquer l'execution) avant d'executer le callback
|
|
|
+ * @param int Nombre de second en attente
|
|
|
+ * @param int Index de la game
|
|
|
+ * @param int Index du joueur dans la game
|
|
|
+ * @param int(*)(Game*, int) Le callback
|
|
|
+ */
|
|
|
void timer(int second, int game, int player, int(*callback)(Game*, int)){
|
|
|
pthread_t thread;
|
|
|
timer_data* t = malloc(sizeof(timer_t));
|