MultiProcessing Lock() doesn't work

I have a program that reads some input text files and write all of them into a list called

ListOutput

which is a shared memory between two processes used in my program (I used two processes so my program runs faster!) I also have a shared memory variable called

processedFiles

which stores the names of the already read input files by any of the processes so the current process does not read them again!

To make sure that two processes do not check the "processedFiles" at the same time (For example in the beginning, it is possible that at the same time they both may come to the conclusion that "processedFiles" is empty so they read the same file), therefore, I added a

Lock

around the checking part for

processedFiles

so one process should complete and release the locked part before the other process checking in to that part!

My problem is that the

Lock

function seems not to work and when I print the current

ProcessName

inside the lock part, it shows that both processes are inside the lock part. I cannot figure out what is wrong with my code? (See the output below.)

Since my main program is not only about reading the input text files and printing them in the list, but it has to do a very complicate operation on the input files before printing them into a list, should I use