[Gambas-user] wait vs sleep confusion, console works, graphically have strange behabior

Tobias Boege taboege at ...626...
Mon Nov 11 20:21:51 CET 2013


On Mon, 11 Nov 2013, PICCORO McKAY Lenz wrote:
> From: Tobias Boege <taboege at ...626...>
> > On Mon, 11 Nov 2013, PICCORO McKAY Lenz wrote:
> >> From: Tobias Boege <taboege at ...626...>
> >> > Sleep puts the program to sleep - literally. It just waits for a given
> >> > time
> >> > to elapse and then resumes execution.
> >> all programs inherint and parent? !! ok thnks for clarification! but
> >> some details more:
> >
> sorry for my very bad english Tobias, i hate that languaje, u clarify
> me very well the usage.. but in one simple question, its same for a
> gambas program console without gui?
> 
> in gui projects, there's a main threat running, and wait do not stop
> that, but in console there's no main threath , u got it?!
> 

Ahh. Actually, there is no "main thread" or something. Gambas is single-
threaded throughout. In GUI programs, the so-called "event loop" kicks in
automatically because you have windows open. See the docs[0]. You can also
force the event loop to run by putting

While True
  Wait 2 ^ 30
Wend

before your Main() ends. This will call the event loop forever without being
too busy in the loop. So your program will not terminate except when you use
Quit or something.

BTW: Gambas is a nice language. You cannot make threats with it :-) Threads
are also not possible in Gambas currently. (You should look up the word
"threat" in a dictionary.) The closest thing you can have is "Task" but I've
no experience with this.

Regards,
Tobi

[0] http://gambasdoc.org/help/cat/eventloop?v3




More information about the User mailing list