Q: Is it possible to lock a columnor row of a ctypes array using get_lock() using numpy? Is it possible to lock a column or row of a ctypes array using get_lock()?
Something like:
lock = mp.Lock()
cArray = mp.Array(ctypes.c_int, 100*4, lock = lock)
numpyArray = np.frombuffer(cArray.get_obj())
numpyArray.shape = (100,4)

#In a function later called via multiprocessing.Process - for example
numpyArray[:,0].get_lock() #Also could be numpyArray.T[0].get_lock()

I know that it is possible to lock the entire ctypes array, but what just a segment of it.  I know the size of the array and it will remain constant so I could compute the offsets in the ctypes array, but wonder - Can one leverage the ease of use of numpy's slicing with a multiprocessing lock?

A: If you have a lock you can lock any code block:
with lock:
    numpyArray[:,0] = 1
    a += 2

Numpy array doesn't have an associated multiprocessing lock. To get it; you could call cArray.get_lock() or just pass as a variable lock.
