Style fixes.

- make mutex and cond var static
- move some definitions/declarations around
This commit is contained in:
Érico Nogueira 2021-10-03 01:36:22 -03:00
parent 44cb175eb3
commit e323a9e59e
1 changed files with 6 additions and 7 deletions

View File

@ -27,18 +27,19 @@ struct task {
atomic_uint removed_count;
};
struct queue {
static struct queue {
pthread_mutex_t mtx;
pthread_cond_t cond;
struct task *tasks;
size_t len, size;
/* number of free threads */
unsigned free;
};
static struct queue queue = {.mtx = PTHREAD_MUTEX_INITIALIZER, .cond = PTHREAD_COND_INITIALIZER};
} queue = {.mtx = PTHREAD_MUTEX_INITIALIZER, .cond = PTHREAD_COND_INITIALIZER};
pthread_mutex_t fd_mtx = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t fd_cond = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t fd_mtx = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t fd_cond = PTHREAD_COND_INITIALIZER;
static unsigned nproc;
static inline void queue_print(struct queue *q)
{
@ -79,8 +80,6 @@ error:
return rv;
}
static unsigned nproc;
static inline int queue_remove(struct queue *q, struct task *t)
{
int rv = 0;