Skip to content

Instantly share code, notes, and snippets.

@mkitti
Created February 17, 2020 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mkitti/704e9e07ea217c9a096d43e9433d8b0d to your computer and use it in GitHub Desktop.
Save mkitti/704e9e07ea217c9a096d43e9433d8b0d to your computer and use it in GitHub Desktop.
JavaCall does not work well with @async
using JavaCall;
println("I threw a wish in the well ...")
JavaCall.init()
println("Hey, I just met you and this is crazy")
jls = @jimport java.lang.System
version = jcall(jls,"getProperty",JString,(JString,),"java.version")
println("Java Version: ",version)
jlm = @jimport java.lang.Math
@async begin
println("But here's my number, so call me maybe")
sin90 = jcall(jlm, "sin", jdouble, (jdouble,), pi/2)
println("sin(90) = ",sin90)
sin45 = jcall(jlm, "sin", jdouble, (jdouble,), pi/4)
println("sin(45) = ",sin45)
println("It's hard to look right at you baby")
end
sleep(3)
println("You took your time with the call")
using JavaCall;
println("I threw a wish in the well ...")
@async begin
println("Hey, I just met you and this is crazy")
JavaCall.init()
println("But here's my number, so call me maybe")
jls = @jimport java.lang.System
version = jcall(jls,"getProperty",JString,(JString,),"java.version")
println("Java Version: ",version)
jlm = @jimport java.lang.Math
sin90 = jcall(jlm, "sin", jdouble, (jdouble,), pi/2)
println("sin(90) = ",sin90)
sin45 = jcall(jlm, "sin", jdouble, (jdouble,), pi/4)
println("sin(45) = ",sin45)
println("It's hard to look right at you baby")
end
sleep(3)
println("You took your time with the call")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment