I'm fairly new to parallel processing but I'm trying to use Channels in a
way I think is consistent with the documentation but I may be
misinterpreting it. I've explained in more detail in a StackOverflow post
<https://stackoverflow.com/questions/35787324/functionality-of-take-and-put-and-channels-in-julia>
but
essentially what I'm trying to do is have an integer variable that several
processes can access and, if one returns an integer smaller than that
variable, can update. The general approach is something like this:
x = Channel{Int64}(1)
put!(x,n)
@everywhere function f(item,chan)
going = true
count = 0
while(going)
going = false
# perform some operations
if (count < fetch(chan) && !conditions_met())
# conditions_met checks the other termination conditions
going = true
count += 1
end
end
count += 1
if (count < fetch(chan))
take!(chan)
put!(chan,count)
end
return count
end
y = @parallel (min) for i in collection
f(i,x)
end
Am I correct in my logic? Is this something I should be able to do?