http://gambaswiki.org/bugtracker/edit?object=BUG.960&from=L21haW4-

Comment #4 by Tobias BOEGE:

To conclude: the warning in [1] targets cases such as this:
  - you enter an event handler for a read-ready stream (like Process_Read)
  - without reading any data, you call Wait.

Since the stream is still ready to be read, you will immediately re-enter the 
event handler and so it goes on without doing any work.

Example code:

    Private $h As Process
    
    Public Sub Main()
      $h = Shell "echo" For Read Write As "Process"
    End
    
    Public Sub Process_Read()
      Wait
    End

Calling Wait in an event handler will not always, not even under bad 
circumstances like many events happening, lead to stack exhaustion. It's 
primarily a matter of where in the event handler you use it and in which 
handler. If you read a small amount of data from the process before calling 
Wait, the number of recursive calls required to consume all the data in the 
Process stream will be finite and, depending on how much data the process 
creates, will not exhaust your stack.

Also I'm setting this bug to invalid because we even hit the rare occasion that 
the solution is explicitly mentioned in the docs :-)

[1] http://gambaswiki.org/wiki/cat/eventloop

Tobias BOEGE changed the state of the bug to: Invalid.



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to