Changes

Jump to navigation Jump to search
90 bytes removed ,  17:01, 1 March 2016
|
* The following function sleeps in parallel; it will be finished in 1 second if your system has at least 2 cores:
<pre class='brush:xquery'>
async:fork-join(
for $i in 1 to 2
return function() { prof:sleep(1000) }
)
</pre>
* In the following query, up to two URLs will be requested in parallel:
<pre class='brush:xquery'>
let $funcs :=
let $url := 'http://url.com/path' || $segment
return function() { http:send-request((), $url) }
return async:fork-join($funcs, map { 'threads': 2 })
</pre>
* In the following query, up to two URLs will be requested in parallel:
<pre class='brush:xquery'>
let $urls := (1 to 4) ! ('http://url.com/path' || .)
let $funcs := $urls ! function() { http:send-request((), .) },
return async:fork-join($funcs, map { 'threads': 2 })
</pre>
Bureaucrats, editor, reviewer, Administrators
13,550

edits

Navigation menu