Baz shows up then. From OS X:
julia> t = @async (println("foo");println("bar"); println("baz"));
foo
julia> bar
julia> baz
_
On Tue, Mar 10, 2015 at 9:28 PM, Amit Murthy wrote:
> What about if you don't print t .
>
> t = @async (println("foo");println("bar"); println("baz"));
>
> On Wed, Mar 11, 2015 at 9:31 AM, Sam L wrote:
>
>> Same thing on arch linux actually:
>>
>> | | |_| | | | (_| | | Version 0.3.7-pre+15 (2015-03-02 23:43 UTC)
>> _/ |\__'_|_|_|\__'_| | Commit 0f0b136 (8 days old release-0.3)
>> |__/ | x86_64-unknown-linux-gnu
>>
>> julia> t = @async (println("foo");println("bar"); println("baz"))
>> foo
>> Task (queued) @0x03c57080bar
>>
>>
>> julia>
>> _
>>
>>
>>
>> On Tuesday, March 10, 2015 at 8:59:52 PM UTC-7, Sam L wrote:
>>>
>>> I see the behavior on OS X. It also occurs with three println's.
>>>
>>> | | |_| | | | (_| | | Version 0.3.7-pre+1 (2015-02-17 22:12 UTC)
>>> _/ |\__'_|_|_|\__'_| | Commit d15f183* (21 days old release-0.3)
>>> |__/ | x86_64-apple-darwin13.4.0
>>>
>>> julia> t = @async (println("foo");println("bar"); println("baz"))
>>> foo
>>> Task (queued) @0x7fa0faf0e520bar
>>>
>>>
>>> julia>
>>> _
>>>
>>> The _ indicates the cursor position after running the line of code. I
>>> hit return only once after the first line starting with 't = @async...',
>>> and I got two blank lines after Task was displayed, before the julia>
>>> prompt, and the cursor ended up in the first column on a new line after the
>>> julia> prompt.
>>>
>>>
>>> On Tuesday, March 10, 2015 at 8:17:30 PM UTC-7, Amit Murthy wrote:
Works fine on Linux.
On Tue, Mar 10, 2015 at 11:28 PM, Ben Arthur
wrote:
> in my continuing quest to understand Julia tasks, i have created the
> following contrived example which does not behave as i would expect. can
> anyone help explain please? thanks in advance.
>
> julia> function printfoobar()
> println("foo")
> println("bar")
> end
>
> printfoobar (generic function with 1 method)
>
> julia> printfoobar() # great, it works
> foo
> bar
>
> julia> println("honey"); println("wagon") # no surprise again
> honey
> wagon
>
> julia> t = @async (println("honey"); println("wagon")) # works too,
> modulo 'Task' being inbetween
> honey
> Task (queued) @0x7fb59e832500wagon
>
> julia> t = @async printfoobar() # ditto: foo and bar both printed,
> albeit with 'Task' inbetween
> foo
> Task (queued) @0x7fb59f2e1720bar
>
> julia> t = @async (println("honey"); printfoobar(); println("wagon"))
> # WHERE ARE bar AND wagon ???
> honey
> Task (queued) @0x7fb59f2e1840foo
>
> julia> # #nope, they still don't appear
>
> julia> #
>
> julia> #
>
> julia> wait(t) # nope, still no further printed output
>
> julia> yield() # still no joy
>
> julia> istaskdone(t)
> true
>
> is it that println("foo") and println("wagon") never get executed? or
> that the output stream is just not making it to the REPL? this is in
> 0.3.6
> by the way. similar things happen on a 0 day old master.
>
>