/*
* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
* Use is subject to license terms.
+ *
+ * Copyright (c) 2012, Intel Corporation.
*/
/*
* This file is part of Lustre, http://www.lustre.org/
* - complete(c)
* - wait_for_completion(c)
*/
-
static wait_handler_t wait_handler;
void init_completion_module(wait_handler_t handler)
return wait_handler(timeout);
}
+#ifndef HAVE_LIBPTHREAD
void init_completion(struct completion *c)
{
LASSERT(c != NULL);
c->done = 0;
- cfs_waitq_init(&c->wait);
+ init_waitqueue_head(&c->wait);
+}
+
+void fini_completion(struct completion *c)
+{
}
void complete(struct completion *c)
{
LASSERT(c != NULL);
c->done = 1;
- cfs_waitq_signal(&c->wait);
+ wake_up(&c->wait);
}
void wait_for_completion(struct completion *c)
} while (c->done == 0);
return 0;
}
+#endif /* HAVE_LIBPTHREAD */
/*
* rw_semaphore:
(void)s;
}
+void downgrade_write(struct rw_semaphore *s)
+{
+ LASSERT(s != NULL);
+ (void)s;
+}
+
int down_write_trylock(struct rw_semaphore *s)
{
LASSERT(s != NULL);
* Multi-threaded user space completion
*/
-void mt_init_completion(mt_completion_t *c)
+void init_completion(struct completion *c)
{
LASSERT(c != NULL);
c->c_done = 0;
pthread_cond_init(&c->c_cond, NULL);
}
-void mt_fini_completion(mt_completion_t *c)
+void fini_completion(struct completion *c)
{
LASSERT(c != NULL);
pthread_mutex_destroy(&c->c_mut);
pthread_cond_destroy(&c->c_cond);
}
-void mt_complete(mt_completion_t *c)
+void complete(struct completion *c)
{
LASSERT(c != NULL);
pthread_mutex_lock(&c->c_mut);
pthread_mutex_unlock(&c->c_mut);
}
-void mt_wait_for_completion(mt_completion_t *c)
+void wait_for_completion(struct completion *c)
{
LASSERT(c != NULL);
pthread_mutex_lock(&c->c_mut);