bash - Synchronize access to shell variables while using Gnu parallel (i.e. critical section in Gnu parallel) -


i have for loop i'd convert parallel. however, i'm appending global (bash) array within loop. what's recommended way of dealing situation? parallel provide form of synchronization between jobs besides --keep-order?

i thought replacing array combination of flock , echo > some_shared_file, wanted know if there's standard way of implementing "critical section" parallel.

bash has "thread local" variables. there no global variables can updated different threads. variables/arrays copied subprocesses, , changes in 1 not reflected in another.

the more general answer -- if had resources updated different processes -- use sem comes gnu parallel.


Comments

Popular posts from this blog

c++ - How to add Crypto++ library to Qt project -

jQuery Mobile app not scrolling in Firefox -

How to use vim as editor in Matlab GUI -