[Gambas-user] Receiving events on an array of process objects

Tobias Boege taboege at gmail.com
Fri May 25 15:03:44 CEST 2018


On Fri, 25 May 2018, PICCORO McKAY Lenz wrote:
> 2018-05-25 6:27 GMT-04:00 Tobias Boege <taboege at gmail.com>:
> 
> > By creating many different processes with the same event name, you can
> > treat
> > events of many objects with a single event handler. The special variable
> > LAST
> > is used during event handlers to indicate which Process raised the event.
> >
> 
> HI tobi, thuis are very interesting to..
> 
> gambas run in one unique threath right?
> 

"thread", yes.

> but from that, if we created more proceses under same name this are
> equivalent of the java group threathing?
> 
> i mean group of threaths? under that main process (the gambas code that
> invoke the other proceses)
> 

What really happens is that you fork() a lot of processes, which execve()
the program that you specify in the EXEC instruction. Those are separate
processes now whose three main file descriptors are linked into the main
Gambas process via pipes (depending on whether you Exec For Read|Write).
Gambas takes those file descriptors and watches them in its event loop.

It is like opening multiple sockets at the same time. You get an event
when any of them has data for you. If all of them have the same event
name, those events happen to be raised with the same prefix. No threads
are involved and there is no concurrent execution of Gambas code.

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk


More information about the User mailing list