# lv_os_private.h (/api/osal/lv_os_private_h)



<RelatedHeaders name="lv_os.h" isPrivate="true" />

<ApiSummary functions="14" enums="1" />

Functions [#functions]

<ApiTabs items="[&#x22;Getters (1)&#x22;,&#x22;Other (13)&#x22;]">
  <ApiTab value="Getters (1)">
    <ApiMember kind="function" name="lv_os_get_idle_percent" file="osal/lv_os_private.h" line="77" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L77">
      lv_os_get_idle_percent [#lv_os_get_idle_percent]

      Set it for `LV_SYSMON_GET_IDLE` to show the CPU usage

      ```c title=" " lineNumbers=1
      uint32_t lv_os_get_idle_percent(void)
      ```

      **Returns:** <ApiLink name="uint32_t" /> — the idle percentage since the last call
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (13)">
    <ApiMember kind="function" name="lv_os_init" file="osal/lv_os_private.h" line="71" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L71">
      lv_os_init [#lv_os_init]

      Initialize the OS layer

      ```c title=" " lineNumbers=1
      void lv_os_init(void)
      ```
    </ApiMember>

    <ApiMember kind="function" name="lv_thread_init" file="osal/lv_os_private.h" line="102" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L102">
      lv_thread_init [#lv_thread_init]

      Create a new thread

      ```c title=" " lineNumbers=1
      lv_result_t lv_thread_init(lv_thread_t *thread, const char *const name, lv_thread_prio_t prio, void(*callback)(void *), size_t stack_size, void *user_data)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name         | Type                                | Description                                       |
      | ------------ | ----------------------------------- | ------------------------------------------------- |
      | `thread`     | `lv_thread_t *`                     | a variable in which the thread will be stored     |
      | `name`       | `const char *const`                 | the name of the thread                            |
      | `prio`       | <ApiLink name="lv_thread_prio_t" /> | priority of the thread                            |
      | `callback`   | `void(*)(void *)`                   | function of the thread                            |
      | `stack_size` | <ApiLink name="size_t" />           | stack size in bytes                               |
      | `user_data`  | `void *`                            | arbitrary data, will be available in the callback |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: success; LV\_RESULT\_INVALID: failure
    </ApiMember>

    <ApiMember kind="function" name="lv_thread_delete" file="osal/lv_os_private.h" line="111" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L111">
      lv_thread_delete [#lv_thread_delete]

      Delete a thread

      ```c title=" " lineNumbers=1
      lv_result_t lv_thread_delete(lv_thread_t *thread)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name     | Type            | Description          |
      | -------- | --------------- | -------------------- |
      | `thread` | `lv_thread_t *` | the thread to delete |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: success; LV\_RESULT\_INVALID: failure
    </ApiMember>

    <ApiMember kind="function" name="lv_mutex_init" file="osal/lv_os_private.h" line="118" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L118">
      lv_mutex_init [#lv_mutex_init]

      Create a mutex

      ```c title=" " lineNumbers=1
      lv_result_t lv_mutex_init(lv_mutex_t *mutex)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type           | Description                                   |
      | ------- | -------------- | --------------------------------------------- |
      | `mutex` | `lv_mutex_t *` | a variable in which the thread will be stored |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: success; LV\_RESULT\_INVALID: failure
    </ApiMember>

    <ApiMember kind="function" name="lv_mutex_lock" file="osal/lv_os_private.h" line="125" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L125">
      lv_mutex_lock [#lv_mutex_lock]

      Lock a mutex

      ```c title=" " lineNumbers=1
      lv_result_t lv_mutex_lock(lv_mutex_t *mutex)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type           | Description       |
      | ------- | -------------- | ----------------- |
      | `mutex` | `lv_mutex_t *` | the mutex to lock |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: success; LV\_RESULT\_INVALID: failure
    </ApiMember>

    <ApiMember kind="function" name="lv_mutex_lock_isr" file="osal/lv_os_private.h" line="132" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L132">
      lv_mutex_lock_isr [#lv_mutex_lock_isr]

      Lock a mutex from interrupt

      ```c title=" " lineNumbers=1
      lv_result_t lv_mutex_lock_isr(lv_mutex_t *mutex)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type           | Description       |
      | ------- | -------------- | ----------------- |
      | `mutex` | `lv_mutex_t *` | the mutex to lock |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: success; LV\_RESULT\_INVALID: failure
    </ApiMember>

    <ApiMember kind="function" name="lv_mutex_unlock" file="osal/lv_os_private.h" line="139" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L139">
      lv_mutex_unlock [#lv_mutex_unlock]

      Unlock a mutex

      ```c title=" " lineNumbers=1
      lv_result_t lv_mutex_unlock(lv_mutex_t *mutex)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type           | Description         |
      | ------- | -------------- | ------------------- |
      | `mutex` | `lv_mutex_t *` | the mutex to unlock |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: success; LV\_RESULT\_INVALID: failure
    </ApiMember>

    <ApiMember kind="function" name="lv_mutex_delete" file="osal/lv_os_private.h" line="146" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L146">
      lv_mutex_delete [#lv_mutex_delete]

      Delete a mutex

      ```c title=" " lineNumbers=1
      lv_result_t lv_mutex_delete(lv_mutex_t *mutex)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name    | Type           | Description         |
      | ------- | -------------- | ------------------- |
      | `mutex` | `lv_mutex_t *` | the mutex to delete |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: success; LV\_RESULT\_INVALID: failure
    </ApiMember>

    <ApiMember kind="function" name="lv_thread_sync_init" file="osal/lv_os_private.h" line="153" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L153">
      lv_thread_sync_init [#lv_thread_sync_init]

      Create a thread synchronization object

      ```c title=" " lineNumbers=1
      lv_result_t lv_thread_sync_init(lv_thread_sync_t *sync)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                 | Description                                 |
      | ------ | -------------------- | ------------------------------------------- |
      | `sync` | `lv_thread_sync_t *` | a variable in which the sync will be stored |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: success; LV\_RESULT\_INVALID: failure
    </ApiMember>

    <ApiMember kind="function" name="lv_thread_sync_wait" file="osal/lv_os_private.h" line="160" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L160">
      lv_thread_sync_wait [#lv_thread_sync_wait]

      Wait for a "signal" on a sync object

      ```c title=" " lineNumbers=1
      lv_result_t lv_thread_sync_wait(lv_thread_sync_t *sync)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                 | Description   |
      | ------ | -------------------- | ------------- |
      | `sync` | `lv_thread_sync_t *` | a sync object |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: success; LV\_RESULT\_INVALID: failure
    </ApiMember>

    <ApiMember kind="function" name="lv_thread_sync_signal" file="osal/lv_os_private.h" line="167" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L167">
      lv_thread_sync_signal [#lv_thread_sync_signal]

      Send a wake-up signal to a sync object

      ```c title=" " lineNumbers=1
      lv_result_t lv_thread_sync_signal(lv_thread_sync_t *sync)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                 | Description   |
      | ------ | -------------------- | ------------- |
      | `sync` | `lv_thread_sync_t *` | a sync object |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: success; LV\_RESULT\_INVALID: failure
    </ApiMember>

    <ApiMember kind="function" name="lv_thread_sync_signal_isr" file="osal/lv_os_private.h" line="174" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L174">
      lv_thread_sync_signal_isr [#lv_thread_sync_signal_isr]

      Send a wake-up signal to a sync object from interrupt

      ```c title=" " lineNumbers=1
      lv_result_t lv_thread_sync_signal_isr(lv_thread_sync_t *sync)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                 | Description   |
      | ------ | -------------------- | ------------- |
      | `sync` | `lv_thread_sync_t *` | a sync object |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: success; LV\_RESULT\_INVALID: failure
    </ApiMember>

    <ApiMember kind="function" name="lv_thread_sync_delete" file="osal/lv_os_private.h" line="181" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L181">
      lv_thread_sync_delete [#lv_thread_sync_delete]

      Delete a sync object

      ```c title=" " lineNumbers=1
      lv_result_t lv_thread_sync_delete(lv_thread_sync_t *sync)
      ```

      <span className="sr-only">
        Parameters
      </span>

      | Name   | Type                 | Description             |
      | ------ | -------------------- | ----------------------- |
      | `sync` | `lv_thread_sync_t *` | a sync object to delete |

      **Returns:** <ApiLink name="lv_result_t" /> — LV\_RESULT\_OK: success; LV\_RESULT\_INVALID: failure
    </ApiMember>
  </ApiTab>
</ApiTabs>

Enums [#enums]

<ApiMember kind="enum" name="lv_thread_prio_t" file="osal/lv_os_private.h" line="56" url="https://github.com/lvgl/lvgl/tree/a7b95c5b0839ce901c09c205610bc2c77cc3345d/src/osal/lv_os_private.h#L56">
  lv_thread_prio_t [#lv_thread_prio_t]

  | Name                     |
  | ------------------------ |
  | `LV_THREAD_PRIO_LOWEST`  |
  | `LV_THREAD_PRIO_LOW`     |
  | `LV_THREAD_PRIO_MID`     |
  | `LV_THREAD_PRIO_HIGH`    |
  | `LV_THREAD_PRIO_HIGHEST` |
</ApiMember>

<TypeUsedBy name="lv_thread_prio_t" count="1">
  * `lv_thread_init` — param `prio`
</TypeUsedBy>

Dependencies [#dependencies]

<FileIncludes includes="[&#x22;lv_conf_internal.h&#x22;, &#x22;lv_os.h&#x22;, &#x22;lv_types.h&#x22;, &#x22;lv_pthread.h&#x22;]" includedBy="[&#x22;lv_global.h&#x22;, &#x22;lv_draw_private.h&#x22;, &#x22;lv_draw_sdl.h&#x22;, &#x22;lv_cache_private.h&#x22;, &#x22;lv_freertos.h&#x22;, &#x22;lv_mqx.h&#x22;]" transitiveIncludes="[&#x22;lv_conf_kconfig.h&#x22;]" />
