The mutexes are supposed to be on the same level as the variables to protect.
So why are tologic/fromlogic are global variables while the protectors tologic_mutex/fromlogic_mutex are not?
Instead of calling lock/unlock directly consider using lock_guard:
And this means you don't need any global variables anymore.
Note that currently the logic_array is not shared across the threads. You should as before instantiate the logic_array in main() and pass it to the threads. Either as pointer or as reference.
Someone helped me to fix the local memory issue that you raised.
Using all this global variables seems to be a step backwards.
Taking a look at the race conditions you see strlen, memcpy, etc. So it has nothing to do with the logic stuff. It looks like it is the mix of c functions (like printf(...)) and C++ classes like thread.