Compare commits

..

6 commits

Author SHA1 Message Date
fd40bae73f Tweak compare_exchange_weak(...) in spin-lock 2023-12-19 16:46:48 +09:00
3e810d27e0 Fix invalid use of mutex in TSLQueue
Mutex was removed in favor of the custom SharedSpinLock.
2023-12-19 16:46:48 +09:00
a6e22271ff Don't fail on "try" fns if failed to get spinLock
In SharedSpinLock: Only fail on "try" fns after spinLock was acquired
and condition is not met.
2023-12-19 16:46:48 +09:00
cd96504e34 Refactor shared-spin-lock to use atomic "spinLock" 2023-12-19 16:46:48 +09:00
424b3cd127 Minor refactorings 2023-12-19 16:46:48 +09:00
980042ad62 Reland C++11 "shared_lock" with iter remove fix
On iterator remove, the iterator will trade the read lock for a write
lock, and trade back for a read lock once the remove has been completed.
2023-12-19 16:46:48 +09:00

View file

@ -6,9 +6,6 @@
/*!
* \file UDPC.h
* \brief Public API for UDPConnection
*
* Note that all functions are thread-safe unless mentioned otherwise in the
* function's documentation.
*/
#ifndef UDPC_CONNECTION_H
@ -864,6 +861,8 @@ UDPC_EXPORT const char *UDPC_atostr(UDPC_HContext ctx, UDPC_IPV6_ADDR_TYPE addr)
* \warning The returned pointer must be freed with free(), or
* UDPC_atostr_unsafe_free(), or UDPC_atostr_unsafe_free_ptr().
*
* This function is thread-safe.
*
* UDPC internally uses UDPC_atostr() for logging. This means that while UDPC
* is running, a string created with UDPC_atostr() may be overwritten
* eventually by UDPC. To avoid this situation, UDPC_atostr_unsafe() or
@ -880,6 +879,8 @@ UDPC_EXPORT const char *UDPC_atostr_unsafe(UDPC_IPV6_ADDR_TYPE addr);
* \warning The returned pointer must be freed with free(), or
* UDPC_atostr_unsafe_free(), or UDPC_atostr_unsafe_free_ptr().
*
* This function is thread-safe.
*
* UDPC internally uses UDPC_atostr() for logging. This means that while UDPC
* is running, a string created with UDPC_atostr() may be overwritten
* eventually by UDPC. To avoid this situation, UDPC_atostr_unsafe() or
@ -890,6 +891,8 @@ UDPC_EXPORT const char *UDPC_atostr_unsafe_cid(UDPC_ConnectionId cid);
/*!
* \brief Free an addr string created with UDPC_atostr_unsafe().
*
* This function is thread-safe.
*/
UDPC_EXPORT void UDPC_atostr_unsafe_free(const char *addrBuf);
@ -897,6 +900,8 @@ UDPC_EXPORT void UDPC_atostr_unsafe_free(const char *addrBuf);
* \brief Free an addr string created with UDPC_atostr_unsafe() and zeroes the
* pointer.
*
* This function is thread-safe.
*
* \code{.c}
* UDPC_ConnectionId aConnectionId = ...;
* const char *addrString = UDPC_atostr_unsafe_cid(aConnectionId);