Skip to content

Instantly share code, notes, and snippets.

@aghecht
Created June 25, 2012 16:41
Show Gist options
  • Save aghecht/2989660 to your computer and use it in GitHub Desktop.
Save aghecht/2989660 to your computer and use it in GitHub Desktop.
Serialize/limit link step in OS/X
#!/bin/sh
lockfile=${TMPDIR}/link.lock
count=1;
while !(shlock -f "${lockfile}${count}" -p $$) do
let count=count+1;
if [ ${count} -eq 5 ]; then
let count=1;
sleep 1;
fi
done
exec /Developer/usr/bin/real-ld "$@"
rm "${lockfile}${count}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment