mirror of
https://github.com/obgm/libcoap.git
synced 2026-11-13 20:00:40 +03:00
coap_delete_pdu: Add in multi-threaded lock protection
The reference counter needs to be protected.
This commit is contained in:
1 parent
109842b833
commit
ba09d0f643
15 files changed
+99
-71
No files matched your search
@@ -400,14 +400,19 @@ COAP_API coap_pdu_t *coap_new_pdu(coap_pdu_type_t type, coap_pdu_code_t code,
|
||||
coap_session_t *session);
|
||||
|
||||
/**
|
||||
* Dispose of an CoAP PDU and frees associated storage.
|
||||
* Not that in general you should not call this function directly.
|
||||
* Dispose of an CoAP PDU and free off associated storage.
|
||||
*
|
||||
* Note: In general you should not call this function directly.
|
||||
* When a PDU is sent with coap_send(), coap_delete_pdu() will be called
|
||||
* automatically for you.
|
||||
* automatically for you. This is not for the case for coap_send_recv()
|
||||
* where the sending and receiving PDUs need to be explicitly deleted.
|
||||
*
|
||||
* Note: If called with a reference count > 0, the reference count is
|
||||
* decremented and the PDU still exists.
|
||||
*
|
||||
* @param pdu The PDU for free off.
|
||||
*/
|
||||
void coap_delete_pdu(coap_pdu_t *pdu);
|
||||
COAP_API void coap_delete_pdu(coap_pdu_t *pdu);
|
||||
|
||||
/**
|
||||
* Duplicate an existing PDU. Specific options can be ignored and not copied
|
||||
|
||||
@@ -374,6 +374,23 @@ int coap_option_check_repeatable(coap_option_num_t number);
|
||||
coap_pdu_t *coap_new_pdu_lkd(coap_pdu_type_t type, coap_pdu_code_t code,
|
||||
coap_session_t *session);
|
||||
|
||||
/**
|
||||
* Dispose of an CoAP PDU and free off associated storage.
|
||||
*
|
||||
* Note: This function must be called in the locked state.
|
||||
*
|
||||
* Note: In general you should not call this function directly.
|
||||
* When a PDU is sent with coap_send(), coap_delete_pdu() will be called
|
||||
* automatically for you. This is not for the case for coap_send_recv()
|
||||
* where the sending and receiving PDUs need to be explicitly deleted.
|
||||
*
|
||||
* Note: If called with a reference count > 0, the reference count is
|
||||
* decremented and the PDU still exists.
|
||||
*
|
||||
* @param pdu The PDU for free off.
|
||||
*/
|
||||
void coap_delete_pdu_lkd(coap_pdu_t *pdu);
|
||||
|
||||
/**
|
||||
* Duplicate an existing PDU. Specific options can be ignored and not copied
|
||||
* across. The PDU data payload is not copied across.
|
||||
|
||||
@@ -319,7 +319,6 @@ int coap_lock_lock_func(void);
|
||||
* @param c Context.
|
||||
*/
|
||||
#define coap_lock_unlock(c) do { \
|
||||
assert(c); \
|
||||
coap_lock_unlock_func(); \
|
||||
} while (0)
|
||||
|
||||
|
||||
Reference in new issue
Block a user