Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/checkpoint-restore/criu.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Tkhai <ktkhai@virtuozzo.com>2016-12-26 17:27:08 +0300
committerPavel Emelyanov <xemul@virtuozzo.com>2017-02-06 14:09:13 +0300
commit735461e1bf54a61eeb9b13fa19b44a67c699a2c8 (patch)
treea5550b10fba7636b4ff19b7d4aab66dc18c4e8f7 /include
parent919df37c2596bbfd3ffd816cb1b38674368d3303 (diff)
files: Implement {set,clear,wait}_fds_event()
The idea is symilar to kernel's wake_up() and wait_event(). One task needs some event. It checks the event has not happened yet (fle hasn't received, unix peer hasn't bound, etc) and calls get_fds_event(). Other task makes the event (sends a fle, binds the peer to a name, etc) and calls set_fds_event(). So, while there is no an event, the first task is sleeping, and the second wakes it up later: Task A: clear_fds_event(); if (!socket_bound) wait_fds_event(); /* sleep */ Task B: bind_socket(); set_fds_event(); /* wake up */ For the details of using see next patches. v5: Use bit operations. Split clear_fds_event from wait function. v2: Do not wait for foreign transport sock is ready, as it's guarantied by we create it before CR_STATE_FORKING. travis-ci: success for Rework file opening scheme to make it asynchronous (rev5) Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com> Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Diffstat (limited to 'include')
-rw-r--r--include/common/lock.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/common/lock.h b/include/common/lock.h
index cb48ea602..f68045cfe 100644
--- a/include/common/lock.h
+++ b/include/common/lock.h
@@ -79,6 +79,12 @@ static inline void futex_set_and_wake(futex_t *f, uint32_t v)
LOCK_BUG_ON(sys_futex((uint32_t *)&f->raw.counter, FUTEX_WAKE, INT_MAX, NULL, NULL, 0) < 0);
}
+/* Wake up all futex @f waiters */
+static inline void futex_wake(futex_t *f)
+{
+ LOCK_BUG_ON(sys_futex((uint32_t *)&f->raw.counter, FUTEX_WAKE, INT_MAX, NULL, NULL, 0) < 0);
+}
+
/* Mark futex @f as wait abort needed and wake up all waiters */
static inline void futex_abort_and_wake(futex_t *f)
{