OK, it seems a workaround may be to use something like eval(Base.Main, 
:(()->CPU_CORES)) in place of the standard anonymous function.

Below, Lemon.getCores(pid) doesn't work, Apple.getCores(pid) does work.

Is there a better way? This workaround seems awkward and overly complicated.

module Lemon
    export getCores
    getCores(pid) = remotecall_fetch(pid, ()->CPU_CORES)
end

module Apple
    export getCores
    getCores(pid) = remotecall_fetch(pid, eval(Base.Main, :(()->CPU_CORES)))
end


Still not sure whether using anonymous function,()->CPU_CORES, is a good 
way to return a global variable from a worker?

I also noted that eval'ing in Main, Base and Base.Main all seemed to work.
I'm not really sure about the differences between these modules. Can 
someone explain?

-- Greg

Reply via email to