Skip to contentSkip to conversation

wait_for_completion(_interruptible)?(_timeout)?

PATCH In review Mike Waychison 1 participant 2 messages Nov 24, 2004

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 wait_for_completion(_interruptible)?(_timeout)?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Thomas, Ingo,

I've tried using the wait_for_completion_interruptible from the patch posted to lkml (http://lkml.org/lkml/2004/10/20/461).

It appears that the timeout/sigpending paths don't call __remove_wait_queue, which is bad when somebody gets around to calling complete_all.

Fixed up patch attached.

- --
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: The opinions expressed in this email are held by me, and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBpAx0dQs4kOxk3/MRArY0AJ9+ZL7DuH9Fa5LurJj7vn2KkhpSeQCdFCnZ iLVrJyiAiNQDfdxYu6X1e88=
=M/3X
-----END PGP SIGNATURE-----

Additional functions for the completion API.

wait_for_completion_interruptible()
wait_for_completion_timeout()
wait_for_completion_interruptible_timeout()

Those are neccecary to convert the users of the racy and obsolete sleep_on variants to the completion API

include/linux/completion.h +6 -0
Index: linux-2.6.9-quilt/include/linux/completion.h
===================================================================
@@ -28,6 +28,12 @@ static inline void init_completion(struc
 }
 
 extern void FASTCALL(wait_for_completion(struct completion *));
+extern int FASTCALL(wait_for_completion_interruptible(struct completion *));
+extern unsigned long FASTCALL(wait_for_completion_timeout(struct completion *,
+							  unsigned long));
+extern unsigned long FASTCALL(wait_for_completion_timeout_interruptible
+			(struct completion *, unsigned long));
+
 extern void FASTCALL(complete(struct completion *));
 extern void FASTCALL(complete_all(struct completion *));
 
kernel/sched.c +100 -0

106 lines not on this page · raw message

author Acked-by Thomas Gleixner on v1 1/1
#1 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 11 lines · Mike Waychison

Hi Thomas, Ingo,

I've tried using the wait_for_completion_interruptible from the patch posted to lkml (http://lkml.org/lkml/2004/10/20/461).

It appears that the timeout/sigpending paths don't call __remove_wait_queue, which is bad when somebody gets around to calling complete_all.

Fixed up patch attached.

Ugh. I must have been half asleep when I originally sent. The attached patch does the fix properly (without the two other typos in the two _timeout variants).

- --
Mike Waychison
Sun Microsystems, Inc.
1 (650) 352-5299 voice
1 (416) 202-8336 voice

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NOTICE: The opinions expressed in this email are held by me, and may not represent the views of Sun Microsystems, Inc.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFBpKQQdQs4kOxk3/MRAuseAKCMWWJR/GdteDuAxLY73O5wSnzhVgCeIe0t K2tuUbZ7ctYQb4ojNIvnCG8=
=DPoG
-----END PGP SIGNATURE-----

Additional functions for the completion API.

wait_for_completion_interruptible()
wait_for_completion_timeout()
wait_for_completion_interruptible_timeout()

Those are neccecary to convert the users of the racy and obsolete sleep_on variants to the completion API

include/linux/completion.h +6 -0
Index: linux-2.6.9-quilt/include/linux/completion.h
===================================================================
@@ -28,6 +28,12 @@ static inline void init_completion(struc
 }
 
 extern void FASTCALL(wait_for_completion(struct completion *));
+extern int FASTCALL(wait_for_completion_interruptible(struct completion *));
+extern unsigned long FASTCALL(wait_for_completion_timeout(struct completion *,
+							  unsigned long));
+extern unsigned long FASTCALL(wait_for_completion_timeout_interruptible
+			(struct completion *, unsigned long));
+
 extern void FASTCALL(complete(struct completion *));
 extern void FASTCALL(complete_all(struct completion *));
 
kernel/sched.c +100 -0

106 lines not on this page · raw message