Ah, I had actually come up with the same solution that Amit suggested in #7176 and am using a named socket as a lock, that seems to work for now.
I’m also running into another race condition with respect to precompile, I opened a new issue for that: https://github.com/JuliaLang/julia/issues/17320 Cheers, David From: julia-users@googlegroups.com [mailto:julia-users@googlegroups.com] On Behalf Of Isaiah Norton Sent: Thursday, July 7, 2016 6:52 AM To: julia-users@googlegroups.com Subject: Re: [julia-users] Pkg "threadsafe" or interprocess mutex package See https://github.com/JuliaLang/julia/issues/5622 and https://github.com/JuliaLang/julia/issues/7176 If you are on Windows, LockFileEx is reliable and you could ccall it yourself. Probably simpler to handle the problem at a higher level for now though (i.e. run one script that checks installation *before* launching your analysis jobs). On Wed, Jul 6, 2016 at 5:09 PM, David Anthoff <anth...@berkeley.edu <mailto:anth...@berkeley.edu> > wrote: Hi, I have a script that is using some packages. The script is set up such that if the package it is trying to use is not installed, it will do a ``Pkg.add`` to add the package before ``using`` it. This script is triggered by a third process, and it might be triggered multiple times simultaneously, i.e. multiple instances of julia might run the same script at the same time. Therefore the second julia instance might issue the same ``Pkg.add`` command as the first instance, while the first instance is not done with the ``Pkg.add`` yet. I assume the package manager per se is not set up to handle that situation gracefully? If not, is there some package that allows me to have something like a mutex/lock between my julia processes, so that I can guard the code section that fiddles with packages and make sure only one julia instance at a time runs that code? Thanks, David -- David Anthoff University of California, Berkeley http://www.david-anthoff.com