Gareth Bult ha scritto: > Hi, > > Very basic question .. is there any way to set off a method or procedure in > Gambas such that it runs in a thread? > > In particular I'm thinking about a Gambas web server where a process might > need to retrieve information from a slow storage device or database server, > or via a raw network socket, and while it's doing that, I don't want it to > block other requests .... ?? > > tia > Gareth > Uhm... nice question. Gambas does not support threads, and can not do asynchronous I/O. But perhaps there is a trick... :->>
Suppose you have to read from a slow device. Let do this job by an external program (/bin/cat, for example); you then launch this external program in background, and rely on its events for reading. Use: exec [...] for read as "exec" public sub exec_read() ... The same could hold true about writing to slow devices; if they are true devices then the kernel should buffer things for you; if it is something else (a database connection), this trick of external programs could work. But in the end, I suspect it is a complicated job... if you want several connections you have to keep trace of every one - not an easy job. And probably it would be slow (on my home machine EXECs are really slow, I don't know why). Regards, -- Doriano Blengino "Listen twice before you speak. This is why we have two ears, but only one mouth." ------------------------------------------------------------------------------ Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM) software. With Adobe AIR, Ajax developers can use existing skills and code to build responsive, highly engaging applications that combine the power of local resources and data with the reach of the web. Download the Adobe AIR SDK and Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user