Skip to content

Commit

Permalink
Add thread safety docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MaJerle committed Aug 23, 2020
1 parent aaef262 commit 96b14ef
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
9 changes: 9 additions & 0 deletions docs/user-manual/how-it-works.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.. _how_it_works:

How it works
============

To be added

.. toctree::
:maxdepth: 2
3 changes: 2 additions & 1 deletion docs/user-manual/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ User manual
.. toctree::
:maxdepth: 2

format-specifier
format-specifier
thread-safety
32 changes: 32 additions & 0 deletions docs/user-manual/thread-safety.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
.. _thread_safety:

Thread safety
=============

With default configuration, LwPRINTF library is *not* thread safe.
This means whenever it is used with operating system, user must resolve it with care.

Library has locking mechanism support for thread safety, which needs to be enabled manually.

.. tip::
To enable thread-safety support, parameter ``LWPRINTF_CFG_OS`` must be set to ``1``.
Please check :ref:`api_lwprintf_opt` for more information about other options.

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 ``lwprintf/src/system/`` folder.

Example code for ``CMSIS-OS V2``

.. note::
Check :ref:`api_lwprintf_sys` section for function description

.. literalinclude:: ../../lwprintf/src/system/lwprintf_sys_cmsis_os.c
:language: c
:linenos:
:caption: System function implementation for CMSIS-OS based operating systems

.. toctree::
:maxdepth: 2

0 comments on commit 96b14ef

Please sign in to comment.