[Gambas-user] Gambas is not multi-threaded, but...
Jussi Lahtinen
jussi.lahtinen at ...626...
Sat Aug 25 01:08:48 CEST 2012
I think I don't have enough time right now to go deeply into this, but I
have already done multithreading with Gambas.
One of my project has interface class which uses exec command to launch
command line program made with Gambas.
Argument for the command line program describe what it should do. Like this:
hProcess = Exec ["gbr3", Application.Path &/ "cmdprog.gambas",
CStr(iWhatToDo)] For Input As "Process"
Interface class has of course Process_Read event for the results.
What I think would be needed is proper way to send more complex data for
the background process and back.
As this mature, it is great new feature for Gambas!
Jussi
On 25 August 2012 01:37, Benoît Minisini <gambas at ...1...>wrote:
> Hi,
>
> In revision #5076, I added a new gb.task component that allows you to
> run a class in the background.
>
> Internally, the interpreter is "simply" forked. But it's not that
> simple. :-)
>
> How does it work?
>
> Once gb.task is checked in the IDE, you get a new class named "Task".
>
> To run a class in the background:
> - That class must inherits Task.
> - It must have a public "Main" method that takes no argument and returns
> nothing. That method will be run in the background.
>
> As the method is run by a fork, it has access to every other part of the
> program, except that the main process that run the task will not see any
> change done by the task!
>
> The main process can simply modify some public variables in the task
> class to define the arguments of the task. But allowing the task to talk
> to the main process to give the result of its work is not done yet.
>
> Maybe the task Main() method will have a Variant return value that will
> be transparently serialized, sent to the main process, and deserialize.
>
> Or maybe the standard output of the task will be redirected to a pipe
> read by the main process.
>
> Or maybe the both solutions... I don't know yet.
>
> Another point. I don't think that gb.qt4 or gb.gtk will be usable after
> the fork.
>
> Tell me what you think about all that!
>
> Regards,
>
> --
> Benoît Minisini
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>
More information about the User
mailing list