Last active
August 29, 2015 14:24
-
-
Save thehajime/65e58a101f0c50a04764 to your computer and use it in GitHub Desktop.
patch for waitqueue issue (libos-nuse/net-next-nuse#45)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/arch/lib/sched.c b/arch/lib/sched.c | |
index 98a568a..3f59028 100644 | |
--- a/arch/lib/sched.c | |
+++ b/arch/lib/sched.c | |
@@ -164,17 +164,35 @@ void finish_wait(wait_queue_head_t *q, wait_queue_t *wait) | |
if (!list_empty(&wait->task_list)) | |
list_del_init(&wait->task_list); | |
} | |
+#if 1 | |
int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, | |
void *key) | |
{ | |
- int ret = default_wake_function(wait, mode, sync, key); | |
+ int ret; | |
+ | |
+ ret = default_wake_function(wait, mode, sync, key); | |
if (ret && (wait->task_list.prev != LIST_POISON2)) | |
list_del_init(&wait->task_list); | |
return ret; | |
} | |
+#else | |
+int autoremove_wake_function(wait_queue_t *wait, unsigned mode, int sync, | |
+ void *key) | |
+{ | |
+ wait_queue_t copy_wait; | |
+ int ret; | |
+ memcpy(©_wait, wait, sizeof(wait_queue_t)); | |
+ ret = default_wake_function(©_wait, mode, sync, key); | |
+ | |
+ if (ret && (copy_wait.task_list.prev != LIST_POISON2)) | |
+ list_del_init(©_wait.task_list); | |
+ | |
+ return ret; | |
+} | |
+#endif | |
int woken_wake_function(wait_queue_t *wait, unsigned mode, int sync, void *key) | |
{ | |
wait->flags |= WQ_FLAG_WOKEN; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment