From cdbc108aa2fcc2e9d105bd17dcb2b2b49bd1e389 Mon Sep 17 00:00:00 2001 From: GauthierMalfilatre Date: Wed, 29 Jul 2026 19:32:52 +0200 Subject: [PATCH 1/3] [ADD] add TODO.md --- TODO.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 TODO.md diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..e957dd1 --- /dev/null +++ b/TODO.md @@ -0,0 +1,3 @@ +# KRONKFLOW - TODO + +[ ] Add multithreading options to the scheduler From fc4158be360ee5d5739a17300ac0d93fb6690bb2 Mon Sep 17 00:00:00 2001 From: GauthierMalfilatre Date: Wed, 29 Jul 2026 19:40:00 +0200 Subject: [PATCH 2/3] [UP] Update TODO.md --- TODO.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/TODO.md b/TODO.md index e957dd1..71923be 100644 --- a/TODO.md +++ b/TODO.md @@ -1,3 +1,5 @@ # KRONKFLOW - TODO [ ] Add multithreading options to the scheduler +[ ] Add Read / Write mask when adding a task so we can do clean multi threading +[ ] Add custom thread pool in C From 72f8a4625ad54803e2b13493893f458a833e91ee Mon Sep 17 00:00:00 2001 From: GauthierMalfilatre Date: Thu, 30 Jul 2026 15:22:04 +0200 Subject: [PATCH 3/3] [FIX] Fix names since this lib is now called kronkflow. (pr -> kf). --- CMakeLists.txt | 36 +++++++++---------- README.md | 30 ++++++++-------- .../macros/optimization.h | 0 .../{prophecy => kronkflow}/macros/types.h | 2 +- include/{prophecy => kronkflow}/scheduler.h | 22 ++++++------ include/{prophecy => kronkflow}/task.h | 14 ++++---- src/minheap/minheap.h | 14 ++++---- src/minheap/minheap_add.c | 2 +- src/minheap/minheap_remove.c | 2 +- src/minheap/minheap_swap.c | 6 ++-- src/scheduler/clear/scheduler_clear.c | 4 +-- src/scheduler/clear/scheduler_destroy.c | 8 ++--- src/scheduler/init/scheduler_create.c | 8 ++--- src/scheduler/init/scheduler_init.c | 8 ++--- src/scheduler/scheduler.h | 8 ++--- src/scheduler/scheduler_addTask.c | 24 ++++++------- src/scheduler/scheduler_currentTick.c | 8 ++--- src/scheduler/scheduler_update.c | 14 ++++---- src/task/task.h | 6 ++-- src/task/task_create.c | 12 +++---- src/task/task_opt.c | 10 +++--- 21 files changed, 119 insertions(+), 119 deletions(-) rename include/{prophecy => kronkflow}/macros/optimization.h (100%) rename include/{prophecy => kronkflow}/macros/types.h (93%) rename include/{prophecy => kronkflow}/scheduler.h (83%) rename include/{prophecy => kronkflow}/task.h (86%) diff --git a/CMakeLists.txt b/CMakeLists.txt index af66063..70d93ee 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,62 +1,62 @@ cmake_minimum_required(VERSION 3.15) -project(prophecy LANGUAGES C) +project(kronkflow LANGUAGES C) if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) message(FATAL_ERROR "Les builds dans le dossier source sont interdits. Créez un dossier de build (ex: 'build/').") endif() -file(GLOB_RECURSE prophecy_SOURCES +file(GLOB_RECURSE kronkflow_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c" ) set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN ON) -add_library(prophecy-obj OBJECT ${prophecy_SOURCES}) +add_library(kronkflow-obj OBJECT ${kronkflow_SOURCES}) -target_include_directories(prophecy-obj +target_include_directories(kronkflow-obj PUBLIC $ $ ) -target_compile_options(prophecy-obj PRIVATE +target_compile_options(kronkflow-obj PRIVATE -Wall -Wextra -O3 ) -set_target_properties(prophecy-obj PROPERTIES +set_target_properties(kronkflow-obj PROPERTIES POSITION_INDEPENDENT_CODE ON ) -add_library(prophecy-static STATIC $) -target_link_libraries(prophecy-static PUBLIC prophecy-obj) +add_library(kronkflow-static STATIC $) +target_link_libraries(kronkflow-static PUBLIC kronkflow-obj) -add_library(prophecy-shared SHARED $) -target_link_libraries(prophecy-shared PUBLIC prophecy-obj) +add_library(kronkflow-shared SHARED $) +target_link_libraries(kronkflow-shared PUBLIC kronkflow-obj) -target_compile_definitions(prophecy-shared PRIVATE prophecy_BUILD_DLL) +target_compile_definitions(kronkflow-shared PRIVATE kronkflow_BUILD_DLL) -add_library(prophecy ALIAS prophecy-static) +add_library(kronkflow ALIAS kronkflow-static) -set_target_properties(prophecy-static PROPERTIES - OUTPUT_NAME prophecy +set_target_properties(kronkflow-static PROPERTIES + OUTPUT_NAME kronkflow ) -set_target_properties(prophecy-shared PROPERTIES - OUTPUT_NAME prophecy +set_target_properties(kronkflow-shared PROPERTIES + OUTPUT_NAME kronkflow ) # NOTE: Installation include(GNUInstallDirs) -install(TARGETS prophecy-static prophecy-shared +install(TARGETS kronkflow-static kronkflow-shared ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) -install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/prophecy +install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/kronkflow DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/README.md b/README.md index 3f3ff07..b6373f7 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Prophecy +# Kronkflow -Prophecy is a lightweight, efficient task scheduler library for C applications. It implements a **min-heap binary tree** to manage task priorities, ensuring optimal resource usage and fast task lookups. +Kronkflow is a lightweight, efficient task scheduler library for C applications. It implements a **min-heap binary tree** to manage task priorities, ensuring optimal resource usage and fast task lookups. ## Features @@ -19,7 +19,7 @@ cmake .. make ``` -This will generate `libprophecy.a` and `libprophecy.so`. You can now install with +This will generate `libkronkflow.a` and `libkronkflow.so`. You can now install with ```bash sudo make install @@ -27,10 +27,10 @@ sudo make install ## Quick Start -Here is a simple example of how to use Prophecy: +Here is a simple example of how to use Kronkflow: ```c -#include "prophecy.h" +#include #include #include @@ -43,21 +43,21 @@ static bool my_handler(void *context, void *data) int main(void) { // Create a scheduler with a capacity of 512 tasks - prScheduler *sch = prScheduler_create(512); + kfScheduler *sch = kfScheduler_create(512); // Add a periodic task (runs in 2 ticks, then every 5 ticks) - prScheduler_addTask(sch, prTask_opt(&my_handler, (void *)1, NULL) 2, 5); + kfScheduler_addTask(sch, kfTask_opt(&my_handler, (void *)1, NULL) 2, 5); // Add a punctual task (runs once in 10 ticks) - prScheduler_addTask(sch, prTask_opt(&my_handler, (void *)3, NULL), 10, 0); + kfScheduler_addTask(sch, kfTask_opt(&my_handler, (void *)3, NULL), 10, 0); // Main loop while (1) { sleep(1); // Simulate time passing - prScheduler_tick(sch, NULL); + kfScheduler_tick(sch, NULL); } - prScheduler_destroy(sch); + kfScheduler_destroy(sch); return true; } ``` @@ -65,13 +65,13 @@ int main(void) ## API Overview ### Scheduler Management -- `prScheduler_create(size_t size)`: Allocate and initialize a new scheduler. -- `prScheduler_destroy(prScheduler *sch)`: Free the scheduler and its resources. -- `prScheduler_tick(prScheduler *sch, void *context)`: Advance the scheduler by one tick and execute ready tasks. +- `kfScheduler_create(size_t size)`: Allocate and initialize a new scheduler. +- `kfScheduler_destroy(kfScheduler *sch)`: Free the scheduler and its resources. +- `kfScheduler_tick(kfScheduler *sch, void *context)`: Advance the scheduler by one tick and execute ready tasks. ### Task Management -- `prTask_opt(prHandler handler, void *data, prClearer clearer)`: Build a task opt structure. -- `prScheduler_addTask(prScheduler *sch, prTask task, prTick delay, prTick interval)`: Register a task in the scheduler. +- `kfTask_opt(prHandler handler, void *data, prClearer clearer)`: Build a task opt structure. +- `kfScheduler_addTask(kfScheduler *sch, kfTask task, prTick delay, prTick interval)`: Register a task in the scheduler. ## License diff --git a/include/prophecy/macros/optimization.h b/include/kronkflow/macros/optimization.h similarity index 100% rename from include/prophecy/macros/optimization.h rename to include/kronkflow/macros/optimization.h diff --git a/include/prophecy/macros/types.h b/include/kronkflow/macros/types.h similarity index 93% rename from include/prophecy/macros/types.h rename to include/kronkflow/macros/types.h index 2e3535c..8c4edd7 100644 --- a/include/prophecy/macros/types.h +++ b/include/kronkflow/macros/types.h @@ -17,6 +17,6 @@ typedef prBool (*prHandler)(void *, void *); typedef void (*prClearer)(void *); typedef uint64_t prTick; - typedef size_t prTaskID; + typedef size_t kfTaskID; #endif /* PROPHECY_MACROS_TYPES_H */ diff --git a/include/prophecy/scheduler.h b/include/kronkflow/scheduler.h similarity index 83% rename from include/prophecy/scheduler.h rename to include/kronkflow/scheduler.h index 0c42bde..8867eb5 100644 --- a/include/prophecy/scheduler.h +++ b/include/kronkflow/scheduler.h @@ -6,9 +6,9 @@ */ #ifndef PROPHECY_SCHEDULER_H #define PROPHECY_SCHEDULER_H - #include "prophecy/macros/types.h" - #include "prophecy/macros/optimization.h" - #include "prophecy/task.h" + #include "kronkflow/macros/types.h" + #include "kronkflow/macros/optimization.h" + #include "kronkflow/task.h" #include #include #include @@ -20,10 +20,10 @@ /////////////////////////////////////////////////////////////////////////////// /** - * @brief Forward declaration of prScheduler type + * @brief Forward declaration of kfScheduler type */ /////////////////////////////////////////////////////////////////////////////// -typedef struct prophecy_scheduler_s prScheduler; +typedef struct prophecy_scheduler_s kfScheduler; /////////////////////////////////////////////////////////////////////////////// @@ -32,10 +32,10 @@ typedef struct prophecy_scheduler_s prScheduler; * @brief Create a task scheduler * * @param size Starting size of tasks scheduler - * @return Returns newly allocated prScheduler, or NULL on error + * @return Returns newly allocated kfScheduler, or NULL on error */ /////////////////////////////////////////////////////////////////////////////// -PR_API prScheduler *prScheduler_create(size_t size); +PR_API kfScheduler *kfScheduler_create(size_t size); /////////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ PR_API prScheduler *prScheduler_create(size_t size); * @param sch The scheduler to destroy */ /////////////////////////////////////////////////////////////////////////////// -PR_API void prScheduler_destroy(prScheduler *sch); +PR_API void kfScheduler_destroy(kfScheduler *sch); /////////////////////////////////////////////////////////////////////////////// @@ -61,7 +61,7 @@ PR_API void prScheduler_destroy(prScheduler *sch); * @return The id of the task added (>1), 0 if failed */ /////////////////////////////////////////////////////////////////////////////// -PR_API prTaskID prScheduler_addTask(prScheduler *sch, prTaskOpt opt, prTick delay, prTick interval); +PR_API kfTaskID kfScheduler_addTask(kfScheduler *sch, kfTaskOpt opt, prTick delay, prTick interval); /////////////////////////////////////////////////////////////////////////////// @@ -74,7 +74,7 @@ PR_API prTaskID prScheduler_addTask(prScheduler *sch, prTaskOpt opt, prTick dela * @return Returns the number of tasks executed this tick */ /////////////////////////////////////////////////////////////////////////////// -PR_API size_t prScheduler_tick(prScheduler *sch, void *context); +PR_API size_t kfScheduler_tick(kfScheduler *sch, void *context); /////////////////////////////////////////////////////////////////////////////// @@ -86,7 +86,7 @@ PR_API size_t prScheduler_tick(prScheduler *sch, void *context); * @return The current tick */ /////////////////////////////////////////////////////////////////////////////// -PR_API prTick prScheduler_currentTick(const prScheduler *sch); +PR_API prTick kfScheduler_currentTick(const kfScheduler *sch); /////////////////////////////////////////////////////////////////////////////// #endif /* PROPHECY_SCHEDULER_H */ diff --git a/include/prophecy/task.h b/include/kronkflow/task.h similarity index 86% rename from include/prophecy/task.h rename to include/kronkflow/task.h index df5ee15..303e137 100644 --- a/include/prophecy/task.h +++ b/include/kronkflow/task.h @@ -6,15 +6,15 @@ */ #ifndef PROPHECY_TASKS_H #define PROPHECY_TASKS_H - #include "prophecy/macros/optimization.h" - #include "prophecy/macros/types.h" + #include "kronkflow/macros/optimization.h" + #include "kronkflow/macros/types.h" /////////////////////////////////////////////////////////////////////////////// /** - * @brief Forward declaration of prTask + * @brief Forward declaration of kfTask */ /////////////////////////////////////////////////////////////////////////////// -typedef struct prophecy_task_s prTask; +typedef struct prophecy_task_s kfTask; /////////////////////////////////////////////////////////////////////////////// @@ -31,7 +31,7 @@ typedef struct prophecy_task_opt_s { void* data; //!< The data to give to the handler prClearer clearer; //!< The clearer of the data if allocated -} prTaskOpt; +} kfTaskOpt; /////////////////////////////////////////////////////////////////////////////// @@ -44,7 +44,7 @@ typedef struct prophecy_task_opt_s { * @param clearer The clearer to clear data if allocated */ /////////////////////////////////////////////////////////////////////////////// -PR_API prTaskOpt prTask_opt(prHandler handler, void *data, prClearer clearer); +PR_API kfTaskOpt kfTask_opt(prHandler handler, void *data, prClearer clearer); /////////////////////////////////////////////////////////////////////////////// @@ -58,7 +58,7 @@ PR_API prTaskOpt prTask_opt(prHandler handler, void *data, prClearer clearer); * @return Returns the new task */ /////////////////////////////////////////////////////////////////////////////// -PR_API prTask prTask_create(prTaskOpt *data, prTick delay, prTick interval); +PR_API kfTask kfTask_create(kfTaskOpt *data, prTick delay, prTick interval); /////////////////////////////////////////////////////////////////////////////// #endif /* PROPHECY_TASKS_H */ diff --git a/src/minheap/minheap.h b/src/minheap/minheap.h index 6360792..bafde92 100644 --- a/src/minheap/minheap.h +++ b/src/minheap/minheap.h @@ -10,19 +10,19 @@ /////////////////////////////////////////////////////////////////////////////// /** - * @brief Forward declaration of prScheduler + * @brief Forward declaration of kfScheduler */ /////////////////////////////////////////////////////////////////////////////// -typedef struct prophecy_scheduler_s prScheduler; +typedef struct prophecy_scheduler_s kfScheduler; /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// /** - * @brief Forward declaration of prTask + * @brief Forward declaration of kfTask */ /////////////////////////////////////////////////////////////////////////////// -typedef struct prophecy_task_s prTask; +typedef struct prophecy_task_s kfTask; /////////////////////////////////////////////////////////////////////////////// @@ -34,7 +34,7 @@ typedef struct prophecy_task_s prTask; * @param idx The index of the task */ /////////////////////////////////////////////////////////////////////////////// -void prMinHeap_add(prScheduler *sch, size_t idx); +void prMinHeap_add(kfScheduler *sch, size_t idx); /////////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ void prMinHeap_add(prScheduler *sch, size_t idx); * @param idx The index of the task to remove */ /////////////////////////////////////////////////////////////////////////////// -void prMinHeap_remove(prScheduler *sch, size_t idx); +void prMinHeap_remove(kfScheduler *sch, size_t idx); /////////////////////////////////////////////////////////////////////////////// @@ -58,7 +58,7 @@ void prMinHeap_remove(prScheduler *sch, size_t idx); * @param task2 The task2 to swap */ /////////////////////////////////////////////////////////////////////////////// -void prMinHeap_swap(prTask *task1, prTask *task2); +void prMinHeap_swap(kfTask *task1, kfTask *task2); /////////////////////////////////////////////////////////////////////////////// #endif /* PROPHECY_MINHEAP_H */ diff --git a/src/minheap/minheap_add.c b/src/minheap/minheap_add.c index a94303a..1477aba 100644 --- a/src/minheap/minheap_add.c +++ b/src/minheap/minheap_add.c @@ -13,7 +13,7 @@ */ // DEBUG: Bubble up void prMinHeap_add( - prScheduler *sch, + kfScheduler *sch, size_t idx ) { diff --git a/src/minheap/minheap_remove.c b/src/minheap/minheap_remove.c index f95ebb5..222f9e1 100644 --- a/src/minheap/minheap_remove.c +++ b/src/minheap/minheap_remove.c @@ -9,7 +9,7 @@ #include void prMinHeap_remove( - prScheduler *sch, + kfScheduler *sch, size_t idx ) { diff --git a/src/minheap/minheap_swap.c b/src/minheap/minheap_swap.c index 4f4f5d5..0bd6867 100644 --- a/src/minheap/minheap_swap.c +++ b/src/minheap/minheap_swap.c @@ -8,11 +8,11 @@ #include "../scheduler/scheduler.h" void prMinHeap_swap( - prTask *task1, - prTask *task2 + kfTask *task1, + kfTask *task2 ) { - prTask tmp = *task1; + kfTask tmp = *task1; *task1 = *task2; *task2 = tmp; diff --git a/src/scheduler/clear/scheduler_clear.c b/src/scheduler/clear/scheduler_clear.c index 855cf07..c0597ed 100644 --- a/src/scheduler/clear/scheduler_clear.c +++ b/src/scheduler/clear/scheduler_clear.c @@ -8,8 +8,8 @@ #include #include -void prScheduler_clear( - prScheduler *sch +void kfScheduler_clear( + kfScheduler *sch ) { if (!sch) { diff --git a/src/scheduler/clear/scheduler_destroy.c b/src/scheduler/clear/scheduler_destroy.c index a38f8fb..78a56bf 100644 --- a/src/scheduler/clear/scheduler_destroy.c +++ b/src/scheduler/clear/scheduler_destroy.c @@ -5,18 +5,18 @@ ** Destroy the scheduler */ #include "../scheduler.h" -#include "prophecy/macros/optimization.h" +#include "kronkflow/macros/optimization.h" #include PR_API -void prScheduler_destroy( - prScheduler *sch +void kfScheduler_destroy( + kfScheduler *sch ) { if (!sch) { return; } - prScheduler_clear(sch); + kfScheduler_clear(sch); free(sch); return; } diff --git a/src/scheduler/init/scheduler_create.c b/src/scheduler/init/scheduler_create.c index 6cbd506..844d7c0 100644 --- a/src/scheduler/init/scheduler_create.c +++ b/src/scheduler/init/scheduler_create.c @@ -5,21 +5,21 @@ ** Create a scheduler */ #include "../scheduler.h" -#include "prophecy/macros/optimization.h" +#include "kronkflow/macros/optimization.h" #include #include PR_API -prScheduler *prScheduler_create( +kfScheduler *kfScheduler_create( size_t size ) { - prScheduler *sch = calloc(1, sizeof(prScheduler)); + kfScheduler *sch = calloc(1, sizeof(kfScheduler)); if (!sch) { return NULL; } - if (prScheduler_init(sch, size) == -1) { + if (kfScheduler_init(sch, size) == -1) { free(sch); return NULL; } diff --git a/src/scheduler/init/scheduler_init.c b/src/scheduler/init/scheduler_init.c index ca5158c..241dbcf 100644 --- a/src/scheduler/init/scheduler_init.c +++ b/src/scheduler/init/scheduler_init.c @@ -4,20 +4,20 @@ ** File description: ** Init the scheduler */ -#include "prophecy/scheduler.h" +#include "kronkflow/scheduler.h" #include "../../task/task.h" #include "../scheduler.h" #include -int prScheduler_init( - prScheduler *sch, +int kfScheduler_init( + kfScheduler *sch, size_t size ) { if (!size) { return -1; } - sch->tasks = calloc(size, sizeof(prTask)); + sch->tasks = calloc(size, sizeof(kfTask)); if (!sch->tasks) { return -1; } diff --git a/src/scheduler/scheduler.h b/src/scheduler/scheduler.h index dd2d7a6..f1213e9 100644 --- a/src/scheduler/scheduler.h +++ b/src/scheduler/scheduler.h @@ -18,12 +18,12 @@ /////////////////////////////////////////////////////////////////////////////// typedef struct prophecy_scheduler_s { - prTask *tasks; //!< The raw array of tasks + kfTask *tasks; //!< The raw array of tasks size_t size; //!< The size of tasks raw array size_t count; //!< The number of tasks pushed prTick tick; //!< The current tick (please tick scheduler at each loop) -} prScheduler; +} kfScheduler; /////////////////////////////////////////////////////////////////////////////// @@ -35,7 +35,7 @@ typedef struct prophecy_scheduler_s { * @param size The starting size of the scheduler */ /////////////////////////////////////////////////////////////////////////////// -int prScheduler_init(prScheduler *sch, size_t size); +int kfScheduler_init(kfScheduler *sch, size_t size); /////////////////////////////////////////////////////////////////////////////// @@ -46,7 +46,7 @@ int prScheduler_init(prScheduler *sch, size_t size); * @param sch The scheduler to clear */ /////////////////////////////////////////////////////////////////////////////// -void prScheduler_clear(prScheduler *sch); +void kfScheduler_clear(kfScheduler *sch); /////////////////////////////////////////////////////////////////////////////// #endif /* PROPHECY_SCHEDULER_IMPL_H */ diff --git a/src/scheduler/scheduler_addTask.c b/src/scheduler/scheduler_addTask.c index 33e4f5b..2818075 100644 --- a/src/scheduler/scheduler_addTask.c +++ b/src/scheduler/scheduler_addTask.c @@ -4,22 +4,22 @@ ** File description: ** add a task to the scheduler */ -#include "prophecy/macros/optimization.h" -#include "prophecy/macros/types.h" +#include "kronkflow/macros/optimization.h" +#include "kronkflow/macros/types.h" #include "scheduler.h" #include #include #include "../minheap/minheap.h" -#include "prophecy/task.h" +#include "kronkflow/task.h" -static int __prScheduler_ensureCapacity( - prScheduler *sch +static int __kfScheduler_ensureCapacity( + kfScheduler *sch ) { - prTask *old = sch->tasks; + kfTask *old = sch->tasks; size_t newSize = (sch->size == 0) ? 16 : sch->size * 2; - sch->tasks = reallocarray(sch->tasks, newSize, sizeof(prTask)); + sch->tasks = reallocarray(sch->tasks, newSize, sizeof(kfTask)); if (!sch->tasks) { sch->tasks = old; return -1; @@ -29,9 +29,9 @@ static int __prScheduler_ensureCapacity( } PR_API -size_t prScheduler_addTask( - prScheduler *sch, - prTaskOpt taskOptions, +size_t kfScheduler_addTask( + kfScheduler *sch, + kfTaskOpt taskOptions, prTick target, prTick interval ) @@ -42,11 +42,11 @@ size_t prScheduler_addTask( return 0; } if (sch->count >= sch->size) { - if (__prScheduler_ensureCapacity(sch) == -1) { + if (__kfScheduler_ensureCapacity(sch) == -1) { return 0; } } - sch->tasks[sch->count] = prTask_create(&taskOptions, target, interval); + sch->tasks[sch->count] = kfTask_create(&taskOptions, target, interval); sch->tasks[sch->count].id = _id; sch->tasks[sch->count].target = sch->tick + target; prMinHeap_add(sch, sch->count); diff --git a/src/scheduler/scheduler_currentTick.c b/src/scheduler/scheduler_currentTick.c index a26612e..04834e2 100644 --- a/src/scheduler/scheduler_currentTick.c +++ b/src/scheduler/scheduler_currentTick.c @@ -4,13 +4,13 @@ ** File description: ** Get scheduler currentt tick */ -#include "prophecy/macros/optimization.h" -#include "prophecy/scheduler.h" +#include "kronkflow/macros/optimization.h" +#include "kronkflow/scheduler.h" #include "scheduler.h" PR_API -prTick prScheduler_currentTick( - const prScheduler *sch +prTick kfScheduler_currentTick( + const kfScheduler *sch ) { if (!sch) { diff --git a/src/scheduler/scheduler_update.c b/src/scheduler/scheduler_update.c index 13af9d5..b8254a8 100644 --- a/src/scheduler/scheduler_update.c +++ b/src/scheduler/scheduler_update.c @@ -4,22 +4,22 @@ ** File description: ** Update the scheduler */ -#include "prophecy/macros/optimization.h" -#include "prophecy/task.h" +#include "kronkflow/macros/optimization.h" +#include "kronkflow/task.h" #include "scheduler.h" #include #include "../task/task.h" #include "../minheap/minheap.h" -#include "prophecy/scheduler.h" +#include "kronkflow/scheduler.h" PR_API -size_t prScheduler_tick( - prScheduler *sch, +size_t kfScheduler_tick( + kfScheduler *sch, void *context ) { size_t done = 0; - prTask ctask; + kfTask ctask; bool r; if (!sch) { @@ -33,7 +33,7 @@ size_t prScheduler_tick( done++; if (r && ctask.interval > 0) { ctask.target = ctask.interval; - prScheduler_addTask(sch, (prTaskOpt){ctask.handler, ctask.data, ctask.clearer}, ctask.interval, ctask.interval); + kfScheduler_addTask(sch, (kfTaskOpt){ctask.handler, ctask.data, ctask.clearer}, ctask.interval, ctask.interval); } else if (ctask.clearer) { ctask.clearer(ctask.data); } diff --git a/src/task/task.h b/src/task/task.h index cf5bfb3..aeda37e 100644 --- a/src/task/task.h +++ b/src/task/task.h @@ -6,8 +6,8 @@ */ #ifndef PROPHECY_TASK_IMPL_H #define PROPHECY_TASK_IMPL_H - #include "prophecy/macros/types.h" - #include "prophecy/task.h" + #include "kronkflow/macros/types.h" + #include "kronkflow/task.h" #include @@ -28,7 +28,7 @@ typedef struct prophecy_task_s { prTick interval; //!< The interval (0 if ponctual, > 0 else) prTick target; //!< The tick remainings. -} prTask; +} kfTask; /////////////////////////////////////////////////////////////////////////////// #endif /* PROPHECY_TASK_IMPL_H */ diff --git a/src/task/task_create.c b/src/task/task_create.c index 01d2c66..d02418f 100644 --- a/src/task/task_create.c +++ b/src/task/task_create.c @@ -4,21 +4,21 @@ ** File description: ** Create a task from parameters */ -#include "prophecy/macros/optimization.h" -#include "prophecy/macros/types.h" -#include "prophecy/task.h" +#include "kronkflow/macros/optimization.h" +#include "kronkflow/macros/types.h" +#include "kronkflow/task.h" #include "task.h" // DEBUG: Make sure opt is not NULL PR_API inline -prTask prTask_create( - prTaskOpt *opt, +kfTask kfTask_create( + kfTaskOpt *opt, prTick delay, prTick interval ) { - return (prTask){ + return (kfTask){ .id = 0, .handler = opt->handler, .data = opt->data, diff --git a/src/task/task_opt.c b/src/task/task_opt.c index d40fd07..51c271d 100644 --- a/src/task/task_opt.c +++ b/src/task/task_opt.c @@ -4,19 +4,19 @@ ** File description: ** Create a task opt from parameters */ -#include "prophecy/macros/optimization.h" -#include "prophecy/macros/types.h" -#include "prophecy/task.h" +#include "kronkflow/macros/optimization.h" +#include "kronkflow/macros/types.h" +#include "kronkflow/task.h" PR_API inline -prTaskOpt prTask_opt( +kfTaskOpt kfTask_opt( prHandler handler, void *data, prClearer clearer ) { - return (prTaskOpt){ + return (kfTaskOpt){ .handler = handler, .data = data, .clearer = clearer