Re: [gtk-list] How to do multi-threading ?



Ionut Borcoman at debian wrote:
> 
> Hi,
> 
> I need something like this :
> 
> 1. An aplication with a START and STOP button.
> 2. The START should set a variable to TRUE (running = TRUE) and call a
> function with an infinite loop like:
> 
> void infiniteLoop()
> {
>         while(running){
>                 /* do something */
>         }
> }
> 
> 3. The STOP should set the variable FALSE so that to force the
> infiniteLoop to finish.
> 

Try this :

void infiniteLoop(void)
{
        while( running ){
                /* do something */

		while ( gtk_events_pending() )
                	gtk_main_iteration();

        }
}

Regards,
Marc



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]