Re-bonjour,

J'ai un soucis avec le prototype de la fonction pthread_create :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
#include <pthread.h>
int pthread_create(pthread_t *restrict tidp, const pthread_attr_t *restrict attr, void *(*start_rtn)(void), void *restrict arg);
Il m'est dit :
The newly created thread starts running at the address of the start_rtn function. This function takes a single argument, arg, which is a typeless pointer. If you need to pass more than one argument to the start_rtn function, then you need to store them in a structure and pass the address of the structure in arg.
Sauf que pour moi void *(*start_rtn)(void) ça signifie que l'argument attendu est un pointeur sur une fonction sans argument qui retourne un pointeur sur fonction ne prenant pas d'argument et retournant un pointeur générique (je sais même plus où mettre les virgules dans cette phrase). Mais bref, je ne comprends pas pourquoi start_rtn prend des arguments du coup. Ça ne devrait pas être plutôt
Code : Sélectionner tout - Visualiser dans une fenêtre à part
int pthread_create(pthread_t *restrict tidp, const pthread_attr_t *restrict attr, void *(*start_rtn(void *restrict argument))(void), void *restrict arg);
?