History: sync_base

This page describes all changes made to the sync_base package since its release.



  • Previous event flags were lost if a task was waiting for multiple event flags, got any, moved to the ready queue and any of the other event flags it was waiting for got set before scheduling the task.
  • Invalidate owner task for deleted mutex.
  • Incorrect sync_run() execution time could occur if there was no active task.
  • In case of priority inheritance the owner task of the mutex could act incorrectly if it was waiting for another mutex.


  • Priority inversion issue fixed, it could happen that a task remained at a higher priority.
  • Mutex can only be released by the owner.
  • Code reorganized and cleaned up.


  • sync_event_flags_clear() added.
  • Public SYNC functions moved to the API file.
  • sync_mutex_get(), sync_mutex_put(), sync_event_flags_get() and sync_event_flags_clear() did not always get rescheduled.
  • Configuration option added to run SYNC forever (if it's used as a single OS).
  • If an asynchronous event was sent to a higher priority task than the running when SYNC was not active the higher priority task was not immediately scheduled when SYNC became active again.
  • The original priority was not restored of the owner task of a mutex in case of deletion of the mutex.


  • os_ variable names renamed to sync_.
  • Instead of storing pointers to the stack pointer only stack pointer is stored as it is only a register in the processor, so there is no point to store the pointer to it. Required for systems where variable size is different to pointer size. For example: MSP430X, medium model where default pointer size is 16 bits but SP is 20 bits.
  • Removed pre-initialized variables and initialize them from sync_init().
  • In case of non-aligned stack pointer the stack size was not calculated correctly, causing the possibility to write over the stack, leading to crash.
  • Some variables from task structure will only be compiled if DEBUG option is enabled.


  • oal_task_delete(), oal_event_delete() and oal_mutex_delete() will only reschedule if the sync scheduler is active. This issue could cause system crash if one of the functions above were called outside sync context.


  •  Reorganized PSP:

           - psp_sync_reg.h removed.

           - psp_sync_sp.h added that contains the definition of the stack pointer type.

           - psp_sync_tick.h added that contains the definition of the tick and the function prototypes (sync_tick_init() and sync_get_tick_count()).

           - psp_sync_int.h added that contains the type of the variable that stores the interrupt state and function prototypes (sync_int_disable() and sync_int_restore()).

  • Fixed tick difference calculation.
  • Fully MISRA-compliant code.
  • Minor changes to be able to do 100% code coverage.
  • sync_event_flags_set_int() renamed to sync_event_flags_set_async() as this function can be used from anywhere outside (or inside) sync to set an event (asynchronously) not just from interrupt.
  • sync_task_yield() moves the active task to the end of the ready queue, let all other tasks to run and let sync_run to return.
  • sync_task_reschedule() introduced to check if any other task needs to be scheduled.
  • Fixed timing for time slice and delay queues. If sync_run needs to return because its time expired then delay queues will be checked using absolute time (difference between the time when the scheduler was called and the time when it was restarted after sync_run returned) and time slicing will use relative time difference (difference between two scheduler calls).
  • sync_task_create() will refuse to create a task with the lowest priority (as it is used by yield).


  • Faulty operation in add and remove queue (task lists); as a consequence it could crash the system under certain conditions.


  • MISRA-compliant.


  • Initial release.