From cbfcdb389f67fb4fa9ad8b41211dfe88280172f9 Mon Sep 17 00:00:00 2001 From: Adrien Bourmault Date: Fri, 11 Jun 2021 13:56:52 +0200 Subject: [PATCH] cleanup inlines --- Makefile | 2 +- include/scheduler.h | 17 +++++++++++++++-- src/scheduler.c | 17 ----------------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 1ffd83d..bf3d151 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ LDFLAGS= -lc -lpthread BINDIR=bin SRCDIR=src DEBDIR=debian -OBJ=$(BINDIR)/scheduler.o $(BINDIR)/server.o $(BINDIR)/localthread.o $(BINDIR)/main.o +OBJ=$(BINDIR)/scheduler.o $(BINDIR)/server.o $(BINDIR)/localworker.o $(BINDIR)/main.o .DEFAULT_GOAL:= all .PHONY: all clean deb diff --git a/include/scheduler.h b/include/scheduler.h index b10a305..a54fa76 100644 --- a/include/scheduler.h +++ b/include/scheduler.h @@ -25,6 +25,19 @@ pthread_t *SchedInit(SchedulerParams_t *parameters); -int SchedWait(pthread_t *schedThread); +// -------------------------------------------------------------------------- // +// Scheduler destructor function // +// -------------------------------------------------------------------------- // +static inline int SchedDestroy(pthread_t *schedThread) +{ + free(schedThread); + return 0; +} -int SchedDestroy(pthread_t *schedThread); +// -------------------------------------------------------------------------- // +// Scheduler wait function // +// -------------------------------------------------------------------------- // +static inline void SchedWait(pthread_t *schedThread) +{ + pthread_join(*schedThread, NULL); +} diff --git a/src/scheduler.c b/src/scheduler.c index e66fb3c..cd91c75 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -36,23 +36,6 @@ pthread_t *SchedInit(SchedulerParams_t *parameters) return parameters->id; } -// -------------------------------------------------------------------------- // -// Scheduler destructor function // -// -------------------------------------------------------------------------- // -int SchedDestroy(pthread_t *schedThread) -{ - free(schedThread); - return 0; -} - -// -------------------------------------------------------------------------- // -// Scheduler wait function // -// -------------------------------------------------------------------------- // -void SchedWait(pthread_t *schedThread) -{ - pthread_join(*schedThread, NULL); -} - // -------------------------------------------------------------------------- // // Scheduler thread main function // // -------------------------------------------------------------------------- //