fixes to multithreaded code
fixes to multithreaded code


Former-commit-id: 3bec33ab6cb54c4fbd414bb6c05838537e240002
syscoin/syscoin,syscoin/syscoin,syscoin/syscoin,syscoin/syscoin,syscoin/syscoin,syscoin/syscoin,syscoin/syscoin,syscoin/syscoin