This commit is contained in:
Mylloon 2024-04-23 12:29:54 +02:00
parent 83295f16ca
commit dc4f0c466b
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -1,11 +1,10 @@
#pragma GCC diagnostic ignored "-Wcast-function-type"
#include "../includes/sched.h"
#include <pthread.h>
#include <stdio.h>
/* Routine d'un thread */
void *sched_worker(void *);
int
sched_init(int nthreads, int qlen, taskfunc f, void *closure)
{
@ -20,15 +19,15 @@ sched_init(int nthreads, int qlen, taskfunc f, void *closure)
int
sched_spawn(taskfunc f, void *closure, struct scheduler *s)
{
// Paramètres inutilisés
(void)f;
(void)closure;
// Paramètre inutilisé
(void)s;
pthread_t thread;
int err;
// Création d'un thread pour la tâche
if((err = pthread_create(&thread, NULL, sched_worker, &s)) != 0) {
if((err = pthread_create(&thread, NULL, (void *(*)(void *))f, closure)) !=
0) {
fprintf(stderr, "pthread_create error %d\n", err);
return -1;
}
@ -41,11 +40,3 @@ sched_spawn(taskfunc f, void *closure, struct scheduler *s)
return 0;
}
void *
sched_worker(void *arg)
{
(void)arg;
return NULL;
}