diff options
author | Eric Wong <normalperson@yhbt.net> | 2012-02-20 16:22:56 -0800 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2012-02-20 16:24:12 -0800 |
commit | 9b820ae2eb0a95a0cfdbaa1494717060fbe254d6 (patch) | |
tree | eb6f7a70e7e7740d49f1736bb6b5dcafa6cc5935 /activeq.h | |
parent | ffabdc47e2c5e295d8c51e059d838a6b8b0b53d6 (diff) | |
download | cmogstored-9b820ae2eb0a95a0cfdbaa1494717060fbe254d6.tar.gz |
Duplicated code is harmful for maintenance. We may be able to do an atomic compare and double-swap (cmp8xchg16) operation in the future...
Diffstat (limited to 'activeq.h')
-rw-r--r-- | activeq.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/activeq.h b/activeq.h new file mode 100644 index 0000000..7da9038 --- /dev/null +++ b/activeq.h @@ -0,0 +1,15 @@ +/* + * Copyright (C) 2012, Eric Wong <normalperson@yhbt.net> + * License: GPLv3 or later (see COPYING for details) + */ + +/* + * This silently inserts the mfd into the active queue without guaranteeing + */ +static inline void mog_activeq_insert(struct mog_queue *q, struct mog_fd *mfd) +{ + mog_fd_check_in(mfd); + CHECK(int, 0, pthread_mutex_lock(&q->activeq_lock)); + SIMPLEQ_INSERT_TAIL(&q->activeq_head, mfd, active_fd); + CHECK(int, 0, pthread_mutex_unlock(&q->activeq_lock)); +} |