# lv_os_private.h (/api/private/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="private/osal/lv_os_private.h" line="74" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L74">
      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:** `uint32_t` — the idle percentage since the last call
    </ApiMember>
  </ApiTab>

  <ApiTab value="Other (13)">
    <ApiMember kind="function" name="lv_os_init" file="private/osal/lv_os_private.h" line="68" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L68">
      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="private/osal/lv_os_private.h" line="99" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L99">
      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` | `size_t`                            | stack size in bytes                                                  |
      | `user_data`  | `void *`                            | arbitrary data, will be available in the callback **May** be `NULL`. |

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

    <ApiMember kind="function" name="lv_thread_delete" file="private/osal/lv_os_private.h" line="108" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L108">
      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="private/osal/lv_os_private.h" line="115" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L115">
      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="private/osal/lv_os_private.h" line="122" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L122">
      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="private/osal/lv_os_private.h" line="129" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L129">
      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="private/osal/lv_os_private.h" line="136" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L136">
      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="private/osal/lv_os_private.h" line="143" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L143">
      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="private/osal/lv_os_private.h" line="150" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L150">
      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="private/osal/lv_os_private.h" line="157" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L157">
      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="private/osal/lv_os_private.h" line="164" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L164">
      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="private/osal/lv_os_private.h" line="171" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L171">
      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="private/osal/lv_os_private.h" line="178" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L178">
      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="private/osal/lv_os_private.h" line="53" url="https://github.com/lvgl/lvgl/tree/e1a0ad863f29742359bc680d6a7d973448ec2285/src/osal/lv_os_private.h#L53">
  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;lvgl_public.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_font_fmt_txt_private.h&#x22;, &#x22;lvgl_private.h&#x22;, &#x22;lv_cache.h&#x22;, &#x22;lv_freertos.h&#x22;, &#x22;lv_linux.h&#x22;, &#x22;lv_mqx.h&#x22;, &#x22;lv_tlsf_private.h&#x22;]" />
