Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Multithreading under windows

Author: Vincent Diepeveen

Date: 18:24:16 12/05/00

Go up one level in this thread


On December 05, 2000 at 12:37:02, Bruce Moreland wrote:

>On December 05, 2000 at 10:28:27, Vincent Diepeveen wrote:
>
>>this is not nonsense. blocking is GARANTUEED by windows.
>>See the microsoft documents on it. they GARANTUEE blocking to
>>prevent parallel problems.
>
>Are you telling me that if I get a mouse button click message from Windows, and
>do something outrageously expensive before returning from that message, that my
>engine threads will block until I return?
>
>bruce

Argh damn it again i wrote something and i wrote it for nothing
as IE4 forgot what i wrote somehow i hit some buttons and all
my written text gone!

Online writing is not my favourite thing!

Anyway what you write here above is a generalization that doesn't
apply always.

What i did was next

  WndProc gets called as user clicks in pulldownwindow quit.
  then in wndproc i call function: killthecrap();

  void KillTheCrap(HWND hwnd, ..) {
    ..
    ..("Are you sure?");
    ..("Are you very sure?");
    ..("You really don't follow my advice?");
    ..
    SendToEngine(QuitEngine); /* now the engine
    gets a quit message. After it has processed it
    it ships acknowledgement to the enginethread
    that listens to the engine.
    The enginethread puts after getting acknowledgement
    the volatile variable quitengine to 1.
    then the enginethread quits.

    while(!quitengine) {
      ;
    }

  }

Now my program was hung. I figured out that the enginethread
was blocked as long as my program was still in the WndProc()

This should be pretty easy to test at home.

Greetings,
Vincent



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.