diff options
author | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-11-21 17:32:34 +0300 |
---|---|---|
committer | Evgeny Grin (Karlson2k) <k2k@narod.ru> | 2023-11-21 17:37:15 +0300 |
commit | b05555f8372fd848698d87133d8ed194820ede1e (patch) | |
tree | aa8bfc0b18ee4747d3810f4452e65ba3bbd76c5a /src/microhttpd/internal.h | |
parent | 38e2c1faacaf061c5a56de537e64eb86bdb4928f (diff) | |
download | libmicrohttpd-b05555f8372fd848698d87133d8ed194820ede1e.tar.gz libmicrohttpd-b05555f8372fd848698d87133d8ed194820ede1e.zip |
Added new daemon flag MHD_USE_NO_THREAD_SAFETY
Do not assume anymore single-threaded environment if external polling
is used.
The application is free to use multiple threads if MHD in the external
polling mode.
The new flag could be used to disable some thread-safety in MHD to
improve single-thread processing speed and resources usage. Basically
the new flag restores the old behaviour for external polling mode.
Diffstat (limited to 'src/microhttpd/internal.h')
-rw-r--r-- | src/microhttpd/internal.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h index 4113e66d..667b6071 100644 --- a/src/microhttpd/internal.h +++ b/src/microhttpd/internal.h | |||
@@ -2551,6 +2551,12 @@ struct MHD_Daemon | |||
2551 | */ | 2551 | */ |
2552 | #define MHD_D_IS_USING_THREAD_PER_CONN_(d) \ | 2552 | #define MHD_D_IS_USING_THREAD_PER_CONN_(d) \ |
2553 | (0 != ((d)->options & MHD_USE_THREAD_PER_CONNECTION)) | 2553 | (0 != ((d)->options & MHD_USE_THREAD_PER_CONNECTION)) |
2554 | |||
2555 | /** | ||
2556 | * Check whether the @a d daemon has thread-safety enabled. | ||
2557 | */ | ||
2558 | #define MHD_D_IS_THREAD_SAFE_(d) \ | ||
2559 | (0 == ((d)->options & MHD_USE_NO_THREAD_SAFETY)) | ||
2554 | #else /* ! MHD_USE_THREADS */ | 2560 | #else /* ! MHD_USE_THREADS */ |
2555 | /** | 2561 | /** |
2556 | * Checks whether the @a d daemon is using internal polling thread | 2562 | * Checks whether the @a d daemon is using internal polling thread |
@@ -2560,6 +2566,11 @@ struct MHD_Daemon | |||
2560 | * Checks whether the @a d daemon is using thread-per-connection mode | 2566 | * Checks whether the @a d daemon is using thread-per-connection mode |
2561 | */ | 2567 | */ |
2562 | #define MHD_D_IS_USING_THREAD_PER_CONN_(d) ((void) d, 0) | 2568 | #define MHD_D_IS_USING_THREAD_PER_CONN_(d) ((void) d, 0) |
2569 | |||
2570 | /** | ||
2571 | * Check whether the @a d daemon has thread-safety enabled. | ||
2572 | */ | ||
2573 | #define MHD_D_IS_THREAD_SAFE_(d) ((void) d, 0) | ||
2563 | #endif /* ! MHD_USE_THREADS */ | 2574 | #endif /* ! MHD_USE_THREADS */ |
2564 | 2575 | ||
2565 | #ifdef HAS_FD_SETSIZE_OVERRIDABLE | 2576 | #ifdef HAS_FD_SETSIZE_OVERRIDABLE |