add functions: fc_queue_push_queue_to_tail etc.
parent
097a7db3cb
commit
c1bb9d6532
5
HISTORY
5
HISTORY
|
|
@ -1,11 +1,12 @@
|
||||||
|
|
||||||
Version 1.49 2021-03-28
|
Version 1.49 2021-04-07
|
||||||
* add macros: FC_ABS and FC_NEGATIVE
|
* add macros: FC_ABS and FC_NEGATIVE
|
||||||
* uniq_skiplist.c: add uniq_skiplist_pair struct and init function
|
* uniq_skiplist.c: add uniq_skiplist_pair struct and init function
|
||||||
* add functions: fc_mkdirs and str_replace
|
* add functions: fc_mkdirs and str_replace
|
||||||
* add FilenameString type and macro
|
* add FilenameString type and macro
|
||||||
* add functions: fc_string_case_compare, fc_string_case_equal etc.
|
* add functions: fc_string_case_compare, fc_string_case_equal etc.
|
||||||
* add functions: fc_check_filename_ex
|
* add function: fc_check_filename_ex
|
||||||
|
* add functions: fc_queue_push_queue_to_tail etc.
|
||||||
|
|
||||||
Version 1.48 2021-02-01
|
Version 1.48 2021-02-01
|
||||||
* fast_buffer.[hc]: add function fast_buffer_append_binary
|
* fast_buffer.[hc]: add function fast_buffer_append_binary
|
||||||
|
|
|
||||||
|
|
@ -135,6 +135,26 @@ void fc_queue_push_queue_to_head_ex(struct fc_queue *queue,
|
||||||
PTHREAD_MUTEX_UNLOCK(&queue->lc_pair.lock);
|
PTHREAD_MUTEX_UNLOCK(&queue->lc_pair.lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void fc_queue_push_queue_to_tail_ex(struct fc_queue *queue,
|
||||||
|
struct fc_queue_info *qinfo, bool *notify)
|
||||||
|
{
|
||||||
|
if (qinfo->head == NULL) {
|
||||||
|
*notify = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
PTHREAD_MUTEX_LOCK(&queue->lc_pair.lock);
|
||||||
|
if (queue->head == NULL) {
|
||||||
|
queue->head = qinfo->head;
|
||||||
|
*notify = true;
|
||||||
|
} else {
|
||||||
|
FC_QUEUE_NEXT_PTR(queue, queue->tail) = qinfo->head;
|
||||||
|
*notify = false;
|
||||||
|
}
|
||||||
|
queue->tail = qinfo->tail;
|
||||||
|
PTHREAD_MUTEX_UNLOCK(&queue->lc_pair.lock);
|
||||||
|
}
|
||||||
|
|
||||||
void fc_queue_pop_to_queue(struct fc_queue *queue,
|
void fc_queue_pop_to_queue(struct fc_queue *queue,
|
||||||
struct fc_queue_info *qinfo)
|
struct fc_queue_info *qinfo)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,34 @@ static inline void fc_queue_push_queue_to_head(struct fc_queue *queue,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline void fc_queue_push_queue_to_head_silence(
|
||||||
|
struct fc_queue *queue, struct fc_queue_info *qinfo)
|
||||||
|
{
|
||||||
|
bool notify;
|
||||||
|
fc_queue_push_queue_to_head_ex(queue, qinfo, ¬ify);
|
||||||
|
}
|
||||||
|
|
||||||
|
void fc_queue_push_queue_to_tail_ex(struct fc_queue *queue,
|
||||||
|
struct fc_queue_info *qinfo, bool *notify);
|
||||||
|
|
||||||
|
static inline void fc_queue_push_queue_to_tail(struct fc_queue *queue,
|
||||||
|
struct fc_queue_info *qinfo)
|
||||||
|
{
|
||||||
|
bool notify;
|
||||||
|
|
||||||
|
fc_queue_push_queue_to_tail_ex(queue, qinfo, ¬ify);
|
||||||
|
if (notify) {
|
||||||
|
pthread_cond_signal(&(queue->lc_pair.cond));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void fc_queue_push_queue_to_tail_silence(
|
||||||
|
struct fc_queue *queue, struct fc_queue_info *qinfo)
|
||||||
|
{
|
||||||
|
bool notify;
|
||||||
|
fc_queue_push_queue_to_tail_ex(queue, qinfo, ¬ify);
|
||||||
|
}
|
||||||
|
|
||||||
void *fc_queue_pop_ex(struct fc_queue *queue, const bool blocked);
|
void *fc_queue_pop_ex(struct fc_queue *queue, const bool blocked);
|
||||||
#define fc_queue_pop(queue) fc_queue_pop_ex(queue, true)
|
#define fc_queue_pop(queue) fc_queue_pop_ex(queue, true)
|
||||||
#define fc_queue_try_pop(queue) fc_queue_pop_ex(queue, false)
|
#define fc_queue_try_pop(queue) fc_queue_pop_ex(queue, false)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue