From: Joe W. <jo...@gm...> - 2010-09-01 15:41:59
|
Hi Adam and Dmitriy, A similar function exists in MarkLogic, xdmp:spawn(). For your reference/discussion: http://developer.marklogic.com/pubs/4.1/apidocs/Ext-6.html#xdmp:spawn Joe On Wed, Sep 1, 2010 at 11:33 AM, Adam Retter <ad...@ex...> wrote: > NO it cant - because the callback function is in the original compiled > xquery and not the xquery executed by the new thread. By time the new > thread finishes executing there is no guarantee that the original > xquery has not finished executing and been discarded (the callback > function along with it)! > > On 1 September 2010 16:32, Dmitriy Shabanov <sha...@gm...> wrote: >> It can be same thread: >> >> run() { >> >> fire-start-event() //through call-back function >> //function body >> //it can have functions to send event through call-back function >> >> fire-end-event() //through call-back function >> } >> >> On Wed, 2010-09-01 at 16:23 +0100, Adam Retter wrote: >>> Problem with a callback is that it would itself have to be another >>> thread, as by this point the main XQuery may have finished executing >>> and been cleaned up. So I dont really see that it gives you anything >>> else, as you get the thread id anyway, and if we add further functions >>> in future you could use these to monitor, cancel thread execution. >>> >>> On 1 September 2010 16:21, Evgeny Gazdovsky <gaz...@gm...> wrote: >>> > run anything after thread will be finished, possible pass into callback the >>> > results of thread >>> > >>> > 2010/9/1 Adam Retter <ada...@go...> >>> >> >>> >> What is the purpose of the callback? >>> >> >>> >> On 1 September 2010 14:51, Evgeny Gazdovsky <gaz...@gm...> wrote: >>> >> > what about more common async function, like >>> >> > util:async($any-code, $callback-function)? >>> >> > So we can use one like: >>> >> > declare function:local:calback($thread-id){ >>> >> > ..... >>> >> > }; >>> >> > util:asynk( >>> >> > (any code here, like at system:run-as()) , >>> >> > util:function("local:callback",1) >>> >> > ) >>> >> > >> >> -- >> Cheers, >> >> Dmitriy Shabanov >> > > > > -- > Adam Retter > > eXist Developer > { United Kingdom } > ad...@ex... > irc://irc.freenode.net/existdb > > ------------------------------------------------------------------------------ > This SF.net Dev2Dev email is sponsored by: > > Show off your parallel programming skills. > Enter the Intel(R) Threading Challenge 2010. > http://p.sf.net/sfu/intel-thread-sfd > _______________________________________________ > Exist-commits mailing list > Exi...@li... > https://lists.sourceforge.net/lists/listinfo/exist-commits > |