mailing list of musl libc
 help / color / mirror / code / Atom feed
* [PATCH 2/2] make the number of spins tuneable
@ 2015-08-29  8:51 Jens Gustedt
  2015-08-29 17:17 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: Jens Gustedt @ 2015-08-29  8:51 UTC (permalink / raw)
  To: musl

---
 src/thread/__wait.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/thread/__wait.c b/src/thread/__wait.c
index a93d41d..46501cb 100644
--- a/src/thread/__wait.c
+++ b/src/thread/__wait.c
@@ -1,8 +1,14 @@
 #include "pthread_impl.h"
 
+#ifndef __WAIT_SPINS
+# define __WAIT_SPINS 100
+#endif
+
+int __wait_spins = __WAIT_SPINS;
+
 void __wait(volatile int *addr, volatile int *waiters, int val, int priv)
 {
-	int spins=100;
+	int spins=__wait_spins;
 	if (priv) priv = FUTEX_PRIVATE;
 	while (spins--) {
 		if (*addr==val) a_spin();
-- 
2.1.4



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] make the number of spins tuneable
  2015-08-29  8:51 [PATCH 2/2] make the number of spins tuneable Jens Gustedt
@ 2015-08-29 17:17 ` Rich Felker
  0 siblings, 0 replies; 2+ messages in thread
From: Rich Felker @ 2015-08-29 17:17 UTC (permalink / raw)
  To: musl

On Sat, Aug 29, 2015 at 10:51:15AM +0200, Jens Gustedt wrote:
> ---
>  src/thread/__wait.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/thread/__wait.c b/src/thread/__wait.c
> index a93d41d..46501cb 100644
> --- a/src/thread/__wait.c
> +++ b/src/thread/__wait.c
> @@ -1,8 +1,14 @@
>  #include "pthread_impl.h"
>  
> +#ifndef __WAIT_SPINS
> +# define __WAIT_SPINS 100
> +#endif
> +
> +int __wait_spins = __WAIT_SPINS;
> +
>  void __wait(volatile int *addr, volatile int *waiters, int val, int priv)
>  {
> -	int spins=100;
> +	int spins=__wait_spins;
>  	if (priv) priv = FUTEX_PRIVATE;
>  	while (spins--) {
>  		if (*addr==val) a_spin();
> -- 
> 2.1.4

I don't understand the intended usage. This is not suitable as a
public API.

Rich


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-08-29 17:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-08-29  8:51 [PATCH 2/2] make the number of spins tuneable Jens Gustedt
2015-08-29 17:17 ` Rich Felker

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).