lwmem/docs/user-manual/thread-safety.rst

32 lines
990 B
ReStructuredText
Raw Normal View History

2019-12-07 03:49:49 +01:00
.. _thread_safety:
Thread safety
=============
With default configuration, LwMEM library is *not* thread safe.
This means whenever it is used with operating system, user must resolve it with care.
2020-08-23 14:58:44 +02:00
Library has locking mechanism support for thread safety, which needs to be enabled manually.
2019-12-07 03:49:49 +01:00
.. tip::
2019-12-07 21:58:57 +01:00
To enable thread-safety support, parameter ``LWMEM_CFG_OS`` must be set to ``1``.
Please check :ref:`api_lwmem_opt` for more information about other options.
2019-12-07 03:49:49 +01:00
After thread-safety features has been enabled, it is necessary to implement
``4`` low-level system functions.
.. tip::
System function template example is available in ``lwmem/src/system/`` folder.
Example code for ``CMSIS-OS V2``
.. note::
2019-12-07 03:49:49 +01:00
Check :ref:`api_lwmem_sys` section for function description
.. literalinclude:: ../../lwmem/src/system/lwmem_sys_cmsis_os.c
:language: c
2019-12-27 22:48:30 +01:00
:linenos:
2019-12-23 11:15:18 +01:00
:caption: System function implementation for CMSIS-OS based operating systems
2019-12-07 03:49:49 +01:00
.. toctree::
:maxdepth: 2