« Return to Thread: Preventing concurrent processing?

Preventing concurrent processing?

by Benjamin Smith :: Rate this Message:

Reply to Author | View in Thread

I'm having a problem with concurrent callbacks being generated.

Say that there are two buttons on the screen, each of which take a few moments
to process. If the user presses button A, and starts the process, and then
presses button B before A's callback is done, then both callbacks
are "running at the same time".

This has resulted in some inconsistent states and program crashes. (EG: the
callback for button A assumes that a certain object is defined, but since
button B was pressed before A was done, that object is no longer there)

Is this making sense? What's the best way to structure things to deal with
this issue?

As a side note, I have a function called "UpdateScreen()" that I use within
these intensive-processing functions as follows, so that the program "appears
responsive"... is this the problem?

Function UpdateScreen()
  {
  while (gtk::events_pending())
        gtk::main_iteration();
  }

-Ben

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

--
PHP-GTK General Mailing List (http://gtk.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

 « Return to Thread: Preventing concurrent processing?