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?