Concurrent Commands.



Hello. 
      I have a question regarding concurrent instructions in gtk+. I will use the following example. Consider a program that creates a window using gtk+ and also prints variables to the terminal from which the program was run. Usless program I know, but good for the example. I want to be able interact with the GUI while the numbers are being printed, but I don't know how.

I tried code like this

...........
...........
...........

int i=0;
while(i!=100000)
{
     cout<<i<<endl;
}

gtk_main();

...................
...............

and this prints out all the variables then starts the GUI.
I reversed them and it started the GUI and didn't print the variables until the GUI was closed. 

I was wondering if there was some signal function in GTK+ where a function and an interval were set. Every time of length interval a signal was sent to the program and the associated function was run. I am a native windows programmer and just new to linux, so this was my first idea.

I have also done some reading on a function fork(), which created two threads through the program. In theory I think that this might work, but am not sure. Does anyone know?

Thanks 
Ciaran

__________________________________________________________________
Get your own FREE, personal Netscape Webmail account today at http://webmail.netscape.com/




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