added thread safety via pthread to the execution of actions