[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libmicrohttpd2] 07/12: mhd_atomic_counter: fixed formatting, fixed sing
From: |
Admin |
Subject: |
[libmicrohttpd2] 07/12: mhd_atomic_counter: fixed formatting, fixed single thread version build |
Date: |
Fri, 06 Jun 2025 16:01:15 +0200 |
This is an automated email from the git hooks/post-receive script.
karlson2k pushed a commit to branch master
in repository libmicrohttpd2.
commit 16533685d082efc6f74e0b6b24cb64bfa6a0721a
Author: Evgeny Grin (Karlson2k) <k2k@drgrin.dev>
AuthorDate: Wed Jun 4 23:35:02 2025 +0200
mhd_atomic_counter: fixed formatting, fixed single thread version build
---
src/mhd2/mhd_atomic_counter.h | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
diff --git a/src/mhd2/mhd_atomic_counter.h b/src/mhd2/mhd_atomic_counter.h
index f0d4f35..9bcf0cd 100644
--- a/src/mhd2/mhd_atomic_counter.h
+++ b/src/mhd2/mhd_atomic_counter.h
@@ -109,8 +109,8 @@ struct mhd_AtomicCounter
* already.
*/
# define mhd_atomic_counter_init(pcnt,initial_value) \
- ((pcnt)->count = (initial_value), \
- mhd_mutex_init_short (&((pcnt)->lock)))
+ ((pcnt)->count = (initial_value), \
+ mhd_mutex_init_short (&((pcnt)->lock)))
/**
* Deinitialise the counter.
@@ -118,15 +118,15 @@ struct mhd_AtomicCounter
* @warning Must be called only for the counters that has been initialised.
*/
# define mhd_atomic_counter_deinit(pcnt) \
- mhd_mutex_destroy_chk (&((pcnt)->lock))
+ mhd_mutex_destroy_chk (&((pcnt)->lock))
/**
* Atomically increment the value of the counter
* @param pcnt the pointer to the counter to increment
*/
-# define mhd_atomic_counter_inc(pcnt) do { \
- mhd_mutex_lock_chk (&((pcnt)->lock)); \
- ++(pcnt->count); \
+# define mhd_atomic_counter_inc(pcnt) do { \
+ mhd_mutex_lock_chk (&((pcnt)->lock)); \
+ ++((pcnt)->count); \
mhd_mutex_unlock_chk (&((pcnt)->lock)); } while (0)
/**
@@ -184,7 +184,7 @@ mhd_atomic_counter_get (struct mhd_AtomicCounter *pcnt);
* already.
*/
# define mhd_atomic_counter_init(pcnt,initial_value) \
- ((pcnt)->count = (initial_value), (! 0))
+ ((pcnt)->count = (initial_value), (! 0))
/**
* Deinitialise the counter.
@@ -197,7 +197,7 @@ mhd_atomic_counter_get (struct mhd_AtomicCounter *pcnt);
* Atomically increment the value of the counter
* @param pcnt the pointer to the counter to increment
*/
-# define mhd_atomic_counter_inc(pcnt) do { ++(pcnt->count); } while (0)
+# define mhd_atomic_counter_inc(pcnt) do { ++((pcnt)->count); } while (0)
/**
* Atomically increment the value of the counter and return the result
@@ -220,6 +220,15 @@ mhd_atomic_counter_get (struct mhd_AtomicCounter *pcnt);
*/
# define mhd_atomic_counter_get(pcnt) ((pcnt)->count)
+/**
+ * Atomically increment the value of the counter and return the result.
+ * The value is allowed to overflow and get back to zero.
+ * @param pcnt the pointer to the counter to increment
+ * @return the final/resulting counter value
+ */
+# define mhd_atomic_counter_inc_wrap_get(pcnt) \
+ mhd_atomic_counter_inc_get (pcnt)
+
#endif /* mhd_ATOMIC_SINGLE_THREAD */
#endif /* ! MHD_ATOMIC_COUNTER_H */
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
- [libmicrohttpd2] branch master updated (2e6777f -> cdd4c1f), Admin, 2025/06/06
- [libmicrohttpd2] 03/12: mhd_response_check_frozen_freeze(): fixed assert, Admin, 2025/06/06
- [libmicrohttpd2] 01/12: Added missing includes for "mhd_assert.h", sorted some includes, Admin, 2025/06/06
- [libmicrohttpd2] 04/12: Improved error reporting for the listen socket creation, Admin, 2025/06/06
- [libmicrohttpd2] 06/12: mhd_stream_finish_req_serving(): minor simplification, Admin, 2025/06/06
- [libmicrohttpd2] 05/12: perf_replies: muted compiler warning, Admin, 2025/06/06
- [libmicrohttpd2] 02/12: Unified debug macro checks, Admin, 2025/06/06
- [libmicrohttpd2] 09/12: Added detection and used "externally_visible" function attribute, Admin, 2025/06/06
- [libmicrohttpd2] 07/12: mhd_atomic_counter: fixed formatting, fixed single thread version build,
Admin <=
- [libmicrohttpd2] 08/12: configure: improved test for alignof() detection, Admin, 2025/06/06
- [libmicrohttpd2] 10/12: Implemented and used counters based on atomic variables, Admin, 2025/06/06
- [libmicrohttpd2] 12/12: get_all_net_updates_by_epoll(): reduced the size of the data passed to the kernel, Admin, 2025/06/06
- [libmicrohttpd2] 11/12: Made zeroing of memory pool optional, other memory pool improvements, Admin, 2025/06/06