diff --git a/include/localworker.h b/include/localworker.h index 52fef6d..7e2b6eb 100644 --- a/include/localworker.h +++ b/include/localworker.h @@ -26,7 +26,7 @@ // -------------------------------------------------------------------------- // // Worker init function // // -------------------------------------------------------------------------- // -pthread_t *WorkerInit(Worker_t *worker); +void WorkerInit(Worker_t *worker); // -------------------------------------------------------------------------- // // Worker destructor function // diff --git a/include/scheduler.h b/include/scheduler.h index 933fe6b..573a81f 100644 --- a/include/scheduler.h +++ b/include/scheduler.h @@ -26,7 +26,7 @@ // -------------------------------------------------------------------------- // // Scheduler init function // // -------------------------------------------------------------------------- // -pthread_t *SchedInit(Scheduler_t *scheduler); +void SchedInit(Scheduler_t *scheduler); // -------------------------------------------------------------------------- // // Scheduler destructor function // diff --git a/include/server.h b/include/server.h index 7c16fe2..b2e4b3d 100644 --- a/include/server.h +++ b/include/server.h @@ -26,7 +26,7 @@ // -------------------------------------------------------------------------- // // Server init function // // -------------------------------------------------------------------------- // -pthread_t *ServerInit(Server_t *server); +void ServerInit(Server_t *server); // -------------------------------------------------------------------------- // // Server destructor function // diff --git a/src/localworker.c b/src/localworker.c index 7d5e467..effcd53 100644 --- a/src/localworker.c +++ b/src/localworker.c @@ -28,14 +28,13 @@ static void *workerMain(void *worker); // -------------------------------------------------------------------------- // // Scheduler init function // // -------------------------------------------------------------------------- // -pthread_t *WorkerInit(Worker_t *worker) +void WorkerInit(Worker_t *worker) { worker->id = (pthread_t*) calloc(1, sizeof(pthread_t)); if (pthread_create(worker->id, NULL, workerMain, worker)) { printLog("Worker #%lu can't be initialized!\n", *(worker->id)); return NULL; } - return worker->id; } // -------------------------------------------------------------------------- // diff --git a/src/main.c b/src/main.c index 40f0331..d816b26 100644 --- a/src/main.c +++ b/src/main.c @@ -21,7 +21,6 @@ #include "../include/base.h" #include "../include/server.h" -#include "../include/scheduler.h" int main(int argc, char **argv) @@ -32,18 +31,18 @@ int main(int argc, char **argv) // Go! printLog("Starting gem-graph-server...\n"); - // // random generator - // t = time(&t); srand((unsigned) t); server0 = (Server_t*) calloc(1, sizeof(Server_t)); + // Launching server ServerInit(server0); ServerWait(server0); + // Exiting ServerDestroy(server0); return 0; diff --git a/src/scheduler.c b/src/scheduler.c index 3692fef..68d17a4 100644 --- a/src/scheduler.c +++ b/src/scheduler.c @@ -32,11 +32,10 @@ static void *schedulerMain(void *scheduler); // -------------------------------------------------------------------------- // // Scheduler init function // // -------------------------------------------------------------------------- // -pthread_t *SchedInit(Scheduler_t *scheduler) +void SchedInit(Scheduler_t *scheduler) { scheduler->id = (pthread_t*) calloc(1, sizeof(pthread_t)); pthread_create(scheduler->id, NULL, schedulerMain, scheduler); - return scheduler->id; } /* -------------------------------------------------------------------------- */ diff --git a/src/server.c b/src/server.c index 70fa6d9..7e4b675 100644 --- a/src/server.c +++ b/src/server.c @@ -32,11 +32,10 @@ static void *serverMain(void *server); // -------------------------------------------------------------------------- // // Scheduler init function // // -------------------------------------------------------------------------- // -pthread_t *ServerInit(Server_t *scheduler) +void ServerInit(Server_t *scheduler) { scheduler->id = (pthread_t*) calloc(1, sizeof(pthread_t)); pthread_create(scheduler->id, NULL, serverMain, scheduler); - return scheduler->id; } // -------------------------------------------------------------------------- //