save cpu !

lawson_whitney at juno.com lawson_whitney at juno.com
Wed Oct 17 21:52:37 CDT 2001


On Wed, 17 Oct 2001, gerard patel wrote:

> Something like that (not sure if this will work :-))
>
> --- message.c.orig      Wed Oct 17 21:33:48 2001
> +++ message.c   Wed Oct 17 23:26:41 2001
> @@ -1170,6 +1170,7 @@
>      ULONG_PTR extra_info = 0;
>      MESSAGEQUEUE *queue = QUEUE_Current();
>      struct received_message_info info, *old_info;
> +    static int toto = 0;
>
>      if (!first && !last) last = ~0;
>
> @@ -1209,7 +1210,14 @@
>          }
>          SERVER_END_VAR_REQ;
>
> -        if (!ret) return FALSE;  /* no message available */
> +        if (!ret)
> +        {
> +             toto++;
> +             if (toto >= 10) Sleep(10);
> +             toto = 0;
> +             return FALSE;  /* no message available */
> +        }
> +        toto = 0;
>
>          TRACE( "got type %d msg %x hwnd %x wp %x lp %lx\n",
>                 info.type, info.msg.message, info.msg.hwnd,
> info.msg.wParam, info.msg.lParam );4
>
> Gerard

Am I seeing it crosseyed, or do you mean something more like

diff -ur was/dlls/user/message.c is/dlls/user/message.c
--- was/dlls/user/message.c	Wed Oct 17 18:17:52 2001
+++ is/dlls/user/message.c	Wed Oct 17 22:43:11 2001
@@ -1170,6 +1170,7 @@
     ULONG_PTR extra_info = 0;
     MESSAGEQUEUE *queue = QUEUE_Current();
     struct received_message_info info, *old_info;
+    static int toto = 0;

     if (!first && !last) last = ~0;

@@ -1209,7 +1210,17 @@
         }
         SERVER_END_VAR_REQ;

-        if (!ret) return FALSE;  /* no message available */
+        if (!ret)
+            {
+                toto++;
+                if (toto >= 10)
+                    {
+                        Sleep(10);
+                        toto = 0;
+                    }
+                return FALSE;  /* no message available */
+            }
+            toto = 0;

         TRACE( "got type %d msg %x hwnd %x wp %x lp %lx\n",
                info.type, info.msg.message, info.msg.hwnd, info.msg.wParam, info.msg.lParam );


If that doesn't work, maybe simply:

diff -ur was/dlls/user/message.c is/dlls/user/message.c
--- was/dlls/user/message.c	Wed Oct 17 18:17:52 2001
+++ is/dlls/user/message.c	Wed Oct 17 22:47:09 2001
@@ -1209,7 +1209,11 @@
         }
         SERVER_END_VAR_REQ;

-        if (!ret) return FALSE;  /* no message available */
+        if (!ret)
+            {
+                Sleep(1);
+                return FALSE;  /* no message available */
+            }

         TRACE( "got type %d msg %x hwnd %x wp %x lp %lx\n",
                info.type, info.msg.message, info.msg.hwnd, info.msg.wParam, info.msg.lParam );


Lawson

"Beware of bugs in the above code; I have only proved it correct, not
tried it."
                -- Donald Knuth


________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
http://dl.www.juno.com/get/web/.




More information about the wine-users mailing list