What is the function of LOCK(cs_main)? Does LOCK(cs_main) pause and branach the program in order to do some necessary job before going on?

I'm trying to publish blocks reactively (as a selfish miner) upon receipt of inventory message from pfrom and react to it after *pfrom* catches up with the  height of my secret block.

Following lines didn't help/there was no reaction on selfish node's side:
added following lines in main.cpp: after l. 3662

   ...
        {
            LOCK(cs_main);
            pfrom-&gt;PushMessage("inv", pfrom-&gt;vPrivateInv);
        }
   ...
LOCK(cs_main) causes the thread to stop execution until a lock can be obtained on cs_main. cs_main is an object representing a type/class/scope of lock. Once the lock is obtained, it lasts until the end of the LOCK statement's scope. (The LOCK macro creates an object on the stack, the destruction of which releases the lock.)

cs_main is already locked in that place, and LOCK uses recursive locks, so your LOCK doesn't do anything.