diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-10-26 22:00:38 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2016-10-27 22:45:01 +0300 |
commit | 01e28f110abc278c40ab7d153665c2dac9d867ce (patch) | |
tree | 528e93d285faac4688ce4f843e30931e18128923 | |
parent | 80d4152e1f287d1572833246dcc3aa676410e9f4 (diff) | |
download | libmicrohttpd-01e28f110abc278c40ab7d153665c2dac9d867ce.tar.gz libmicrohttpd-01e28f110abc278c40ab7d153665c2dac9d867ce.zip |
Added thread-safety functions marks
-rw-r--r-- | src/microhttpd/daemon.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/microhttpd/daemon.c b/src/microhttpd/daemon.c index f22c717a..7d5b4e4a 100644 --- a/src/microhttpd/daemon.c +++ b/src/microhttpd/daemon.c | |||
@@ -1001,6 +1001,8 @@ MHD_cleanup_upgraded_connection_ (struct MHD_Connection *connection) | |||
1001 | /** | 1001 | /** |
1002 | * Performs bi-directional forwarding on upgraded HTTPS connections | 1002 | * Performs bi-directional forwarding on upgraded HTTPS connections |
1003 | * based on the readyness state stored in the @a urh handle. | 1003 | * based on the readyness state stored in the @a urh handle. |
1004 | * @remark To be called only from thread that process | ||
1005 | * connection's recv(), send() and response. | ||
1004 | * | 1006 | * |
1005 | * @param urh handle to process | 1007 | * @param urh handle to process |
1006 | */ | 1008 | */ |
@@ -1261,6 +1263,8 @@ process_urh (struct MHD_UpgradeResponseHandle *urh) | |||
1261 | /** | 1263 | /** |
1262 | * Main function of the thread that handles an individual connection | 1264 | * Main function of the thread that handles an individual connection |
1263 | * after it was "upgraded" when #MHD_USE_THREAD_PER_CONNECTION is set. | 1265 | * after it was "upgraded" when #MHD_USE_THREAD_PER_CONNECTION is set. |
1266 | * @remark To be called only from thread that process | ||
1267 | * connection's recv(), send() and response. | ||
1264 | * | 1268 | * |
1265 | * @param con the connection this thread will handle | 1269 | * @param con the connection this thread will handle |
1266 | */ | 1270 | */ |
@@ -1938,6 +1942,9 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon); | |||
1938 | * | 1942 | * |
1939 | * Per-IP connection limits are ignored when using this API. | 1943 | * Per-IP connection limits are ignored when using this API. |
1940 | * | 1944 | * |
1945 | * @remark To be called only from thread that process | ||
1946 | * daemon's select()/poll()/etc. | ||
1947 | * | ||
1941 | * @param daemon daemon that manages the connection | 1948 | * @param daemon daemon that manages the connection |
1942 | * @param client_socket socket to manage (MHD will expect | 1949 | * @param client_socket socket to manage (MHD will expect |
1943 | * to receive an HTTP request from this socket next). | 1950 | * to receive an HTTP request from this socket next). |
@@ -2343,6 +2350,10 @@ internal_add_connection (struct MHD_Daemon *daemon, | |||
2343 | * socket leaks or lead to undefined behavior). You must explicitly | 2350 | * socket leaks or lead to undefined behavior). You must explicitly |
2344 | * resume all connections before stopping the daemon. | 2351 | * resume all connections before stopping the daemon. |
2345 | * | 2352 | * |
2353 | * @remark In thread-per-connection mode: can be called from any thread, | ||
2354 | * in any other mode: to be called only from thread that process | ||
2355 | * daemon's select()/poll()/etc. | ||
2356 | * | ||
2346 | * @param connection the connection to suspend | 2357 | * @param connection the connection to suspend |
2347 | */ | 2358 | */ |
2348 | void | 2359 | void |
@@ -2588,6 +2599,8 @@ MHD_add_connection (struct MHD_Daemon *daemon, | |||
2588 | * Accept an incoming connection and create the MHD_Connection object for | 2599 | * Accept an incoming connection and create the MHD_Connection object for |
2589 | * it. This function also enforces policy by way of checking with the | 2600 | * it. This function also enforces policy by way of checking with the |
2590 | * accept policy callback. | 2601 | * accept policy callback. |
2602 | * @remark To be called only from thread that process | ||
2603 | * daemon's select()/poll()/etc. | ||
2591 | * | 2604 | * |
2592 | * @param daemon handle with the listen socket | 2605 | * @param daemon handle with the listen socket |
2593 | * @return #MHD_YES on success (connections denied by policy or due | 2606 | * @return #MHD_YES on success (connections denied by policy or due |
@@ -2804,6 +2817,8 @@ MHD_cleanup_connections (struct MHD_Daemon *daemon) | |||
2804 | * `select()` or `poll()` should at most block, not the timeout value set | 2817 | * `select()` or `poll()` should at most block, not the timeout value set |
2805 | * for connections. This function MUST NOT be called if MHD is | 2818 | * for connections. This function MUST NOT be called if MHD is |
2806 | * running with #MHD_USE_THREAD_PER_CONNECTION. | 2819 | * running with #MHD_USE_THREAD_PER_CONNECTION. |
2820 | * @remark To be called only from thread that process | ||
2821 | * daemon's select()/poll()/etc. | ||
2807 | * | 2822 | * |
2808 | * @param daemon daemon to query for timeout | 2823 | * @param daemon daemon to query for timeout |
2809 | * @param timeout set to the timeout (in milliseconds) | 2824 | * @param timeout set to the timeout (in milliseconds) |
@@ -3496,6 +3511,8 @@ MHD_poll (struct MHD_Daemon *daemon, | |||
3496 | * upgraded. This requires a separate epoll() invocation as we | 3511 | * upgraded. This requires a separate epoll() invocation as we |
3497 | * cannot use the `struct MHD_Connection` data structures for | 3512 | * cannot use the `struct MHD_Connection` data structures for |
3498 | * the `union epoll_data` in this case. | 3513 | * the `union epoll_data` in this case. |
3514 | * @remark To be called only from thread that process | ||
3515 | * daemon's select()/poll()/etc. | ||
3499 | */ | 3516 | */ |
3500 | static int | 3517 | static int |
3501 | run_epoll_for_upgrade (struct MHD_Daemon *daemon) | 3518 | run_epoll_for_upgrade (struct MHD_Daemon *daemon) |
@@ -4557,6 +4574,8 @@ setup_epoll_fd (struct MHD_Daemon *daemon) | |||
4557 | /** | 4574 | /** |
4558 | * Setup epoll() FD for the daemon and initialize it to listen | 4575 | * Setup epoll() FD for the daemon and initialize it to listen |
4559 | * on the listen FD. | 4576 | * on the listen FD. |
4577 | * @remark To be called only from thread that process | ||
4578 | * daemon's select()/poll()/etc. | ||
4560 | * | 4579 | * |
4561 | * @param daemon daemon to initialize for epoll() | 4580 | * @param daemon daemon to initialize for epoll() |
4562 | * @return #MHD_YES on success, #MHD_NO on failure | 4581 | * @return #MHD_YES on success, #MHD_NO on failure |
@@ -5363,6 +5382,8 @@ thread_failed: | |||
5363 | * Close all connections for the daemon; must only be called after | 5382 | * Close all connections for the daemon; must only be called after |
5364 | * all of the threads have been joined and there is no more concurrent | 5383 | * all of the threads have been joined and there is no more concurrent |
5365 | * activity on the connection lists. | 5384 | * activity on the connection lists. |
5385 | * @remark To be called only from thread that process | ||
5386 | * daemon's select()/poll()/etc. | ||
5366 | * | 5387 | * |
5367 | * @param daemon daemon to close down | 5388 | * @param daemon daemon to close down |
5368 | */ | 5389 | */ |