|
|
|
|
@ -270,10 +270,12 @@ static void check_waiters(struct ll_queue* q) {
|
|
|
|
|
int queue_data_put(struct ll_queue* q, struct ll_entry* entry, uint32_t id) { |
|
|
|
|
if (!q || !entry) return -1; |
|
|
|
|
|
|
|
|
|
#ifdef QUEUE_THREAD_CHECK |
|
|
|
|
queue_check_thread(q); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
#ifdef QUEUE_DEBUG |
|
|
|
|
queue_check_consistency(q);// !!!! for debug - BEFORE callback
|
|
|
|
|
// queue_check_consistency(q);// !!!! for debug - BEFORE callback
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
entry->id = id; |
|
|
|
|
@ -327,8 +329,10 @@ int queue_data_put(struct ll_queue* q, struct ll_entry* entry, uint32_t id) {
|
|
|
|
|
int queue_data_put_first(struct ll_queue* q, struct ll_entry* entry, uint32_t id) { |
|
|
|
|
if (!q || !entry) return -1; |
|
|
|
|
|
|
|
|
|
#ifdef QUEUE_THREAD_CHECK |
|
|
|
|
queue_check_thread(q); |
|
|
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
entry->id = id; |
|
|
|
|
|
|
|
|
|
// Проверить лимит размера
|
|
|
|
|
@ -381,7 +385,9 @@ int queue_data_put_first(struct ll_queue* q, struct ll_entry* entry, uint32_t id
|
|
|
|
|
struct ll_entry* queue_data_get(struct ll_queue* q) { |
|
|
|
|
if (!q || !q->head) return NULL; |
|
|
|
|
|
|
|
|
|
#ifdef QUEUE_THREAD_CHECK |
|
|
|
|
queue_check_thread(q); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
struct ll_entry* entry = q->head; |
|
|
|
|
|
|
|
|
|
@ -437,8 +443,8 @@ int queue_check_consistency(struct ll_queue* q) {
|
|
|
|
|
if (current->next) { |
|
|
|
|
if (current->next->prev != current) { |
|
|
|
|
// Несоответствие в связях prev/next
|
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_LL_QUEUE, "Queue '%s': prev/next error at entry %p", |
|
|
|
|
q->name ? q->name : "unknown", (void*)current); |
|
|
|
|
DEBUG_ERROR(DEBUG_CATEGORY_LL_QUEUE, "Queue '%s': prev/next error at entry %p != %p entries: %d!=%d bytes: %zu!=%zu", |
|
|
|
|
q->name ? q->name : "unknown", (void*)current, (void*)current->next->prev, actual_count, q->count, actual_bytes, q->total_bytes); |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -512,7 +518,9 @@ struct ll_entry* queue_find_data_by_id(struct ll_queue* q, uint32_t id) {
|
|
|
|
|
int queue_remove_data(struct ll_queue* q, struct ll_entry* entry) { |
|
|
|
|
if (!q || !entry) return -1; |
|
|
|
|
|
|
|
|
|
#ifdef QUEUE_THREAD_CHECK |
|
|
|
|
queue_check_thread(q); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
// Удалить из двусвязного списка
|
|
|
|
|
if (entry->prev) { |
|
|
|
|
|