Prefix CONTAINER_OF with UC_
This commit is contained in:
+17
-7
@@ -57,7 +57,9 @@ int uc_thread_queue_init(struct uc_threadqueue *queue, long max_elements)
|
||||
return rc;
|
||||
}
|
||||
|
||||
int uc_thread_queue_tryadd(struct uc_threadqueue *queue, const struct timespec *timeout, struct uc_threadmsg *msg)
|
||||
int uc_thread_queue_tryadd(struct uc_threadqueue *queue,
|
||||
const struct timespec *timeout,
|
||||
struct uc_threadmsg *msg)
|
||||
{
|
||||
int rc = 0;
|
||||
struct timespec abstimeout;
|
||||
@@ -81,7 +83,8 @@ int uc_thread_queue_tryadd(struct uc_threadqueue *queue, const struct timespec *
|
||||
if(timeout->tv_sec == 0 && timeout->tv_nsec == 0) {
|
||||
rc = ETIMEDOUT;
|
||||
} else {
|
||||
rc = pthread_cond_timedwait(&queue->write_cond, &queue->mutex, &abstimeout);
|
||||
rc = pthread_cond_timedwait(&queue->write_cond, &queue->mutex,
|
||||
&abstimeout);
|
||||
}
|
||||
|
||||
} else {
|
||||
@@ -127,7 +130,9 @@ int uc_thread_queue_tryadd(struct uc_threadqueue *queue, const struct timespec *
|
||||
|
||||
}
|
||||
|
||||
int uc_thread_queue_tryget(struct uc_threadqueue *queue, const struct timespec *timeout, struct uc_threadmsg **msg)
|
||||
int uc_thread_queue_tryget(struct uc_threadqueue *queue,
|
||||
const struct timespec *timeout,
|
||||
struct uc_threadmsg **msg)
|
||||
{
|
||||
int rc = 0;
|
||||
struct timespec abstimeout;
|
||||
@@ -153,7 +158,8 @@ int uc_thread_queue_tryget(struct uc_threadqueue *queue, const struct timespec *
|
||||
if(timeout->tv_sec == 0 && timeout->tv_nsec == 0) {
|
||||
rc = ETIMEDOUT;
|
||||
} else {
|
||||
rc = pthread_cond_timedwait(&queue->read_cond, &queue->mutex, &abstimeout);
|
||||
rc = pthread_cond_timedwait(&queue->read_cond, &queue->mutex,
|
||||
&abstimeout);
|
||||
}
|
||||
} else {
|
||||
pthread_cond_wait(&queue->read_cond, &queue->mutex);
|
||||
@@ -192,17 +198,20 @@ int uc_thread_queue_tryget(struct uc_threadqueue *queue, const struct timespec *
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void uc_thread_queue_walk_unlocked(struct uc_threadqueue *queue, uc_thread_queue_walk_func walk_func)
|
||||
static void uc_thread_queue_walk_unlocked(struct uc_threadqueue *queue,
|
||||
uc_thread_queue_walk_func walk_func)
|
||||
{
|
||||
struct uc_threadmsg *p;
|
||||
struct uc_threadmsg *next;
|
||||
|
||||
for(p = queue->first; p; p = next) {
|
||||
next = p->next;
|
||||
walk_func(p);
|
||||
}
|
||||
}
|
||||
|
||||
int uc_thread_queue_walk(struct uc_threadqueue *queue, uc_thread_queue_walk_func walk_func)
|
||||
int uc_thread_queue_walk(struct uc_threadqueue *queue,
|
||||
uc_thread_queue_walk_func walk_func)
|
||||
{
|
||||
if (queue == NULL || !walk_func) {
|
||||
return EINVAL;
|
||||
@@ -217,7 +226,8 @@ int uc_thread_queue_walk(struct uc_threadqueue *queue, uc_thread_queue_walk_func
|
||||
return 0;
|
||||
}
|
||||
|
||||
int uc_thread_queue_destroy(struct uc_threadqueue *queue, uc_thread_queue_walk_func free_func)
|
||||
int uc_thread_queue_destroy(struct uc_threadqueue *queue,
|
||||
uc_thread_queue_walk_func free_func)
|
||||
{
|
||||
int rc;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user