mirror of
https://github.com/espressif/esp-idf.git
synced 2025-06-25 01:11:38 +02:00
Merge branch 'docs/update_http_server_uri_fun_doc_regarding_thread_safe' into 'master'
Updated the http_server doc regarding thread safety Closes IDFGH-15207 See merge request espressif/esp-idf!39587
This commit is contained in:
@ -12,6 +12,8 @@ The HTTP Server component provides an ability for running a lightweight web serv
|
||||
* :cpp:func:`httpd_stop`: This stops the server with the provided handle and frees up any associated memory/resources. This is a blocking function that first signals a halt to the server task and then waits for the task to terminate. While stopping, the task closes all open connections, removes registered URI handlers and resets all session context data to empty.
|
||||
* :cpp:func:`httpd_register_uri_handler`: A URI handler is registered by passing object of type ``httpd_uri_t`` structure which has members including ``uri`` name, ``method`` type (eg. ``HTTP_GET/HTTP_POST/HTTP_PUT`` etc.), function pointer of type ``esp_err_t *handler (httpd_req_t *req)`` and ``user_ctx`` pointer to user context data.
|
||||
|
||||
.. note:: APIs in the HTTP server are not thread-safe. If thread safety is required, it is the responsibility of the application layer to ensure proper synchronization between multiple tasks.
|
||||
|
||||
Application Examples
|
||||
--------------------
|
||||
|
||||
|
@ -32,6 +32,8 @@ The following APIs of :doc:`esp_http_server` should not be used with :doc:`esp_h
|
||||
|
||||
Everything else can be used without limitations.
|
||||
|
||||
.. note:: APIs in the HTTPS server are not thread-safe. If thread safety is required, it is the responsibility of the application layer to ensure proper synchronization between multiple tasks.
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
|
@ -12,6 +12,8 @@ HTTP Server 组件提供了在 ESP32 上运行轻量级 Web 服务器的功能
|
||||
* :cpp:func:`httpd_stop`: 根据传入的句柄停止服务器,并释放相关联的内存和资源。这是一个阻塞函数,首先给服务器任务发送停止信号,然后等待其终止。期间服务器任务会关闭所有已打开的连接,删除已注册的 URI 处理程序,并将所有会话的上下文数据重置为空。
|
||||
* :cpp:func:`httpd_register_uri_handler`: 通过传入 ``httpd_uri_t`` 结构体类型的对象来注册 URI 处理程序。该结构体包含如下成员:``uri`` 名字,``method`` 类型(比如 ``HTTP_GET/HTTP_POST/HTTP_PUT`` 等等), ``esp_err_t *handler (httpd_req_t *req)`` 类型的函数指针,指向用户上下文数据的 ``user_ctx`` 指针。
|
||||
|
||||
.. note:: HTTP Server 组件的 API 并不是线程安全的。如果需要线程安全,应用层需自行确保在多个任务之间进行适当的同步。
|
||||
|
||||
应用示例
|
||||
--------
|
||||
|
||||
|
@ -32,6 +32,8 @@ API 说明
|
||||
|
||||
其他 API 均可使用,没有其他限制。
|
||||
|
||||
.. note:: HTTPS 服务器的 API 并不是线程安全的。如果需要线程安全,应用层需自行确保在多个任务之间进行适当的同步。
|
||||
|
||||
如何使用
|
||||
---------
|
||||
|
||||
|
Reference in New Issue
Block a user