Porting MinGW multithreading bugfix to makefile.mingw
Porting MinGW multithreading bugfix to makefile.mingw

Original fix:
https://github.com/bitcoin/bitcoin/commit
/8864019f6d88b13d3442843d9e6ebeb8dd938831

coinkeeper/anoncoin_20150330_fixes,vertcoin/eyeglass,Litecoindark/LTCD,nanocoins/mycoin,koharjidan/litecoin,coinkeeper/anoncoin_20150330_fixes,Ziftr/litecoin,bootycoin-project/bootycoin,mooncoin-project/mooncoin-landann,bootycoin-project/bootycoin,zzkt/solarcoin,coinkeeper/2015-04-19_21-20_litecoindark,scamcoinz/scamcoin,ANCompany/birdcoin-dev,dakk/soundcoin,kryptokredyt/ProjektZespolowyCoin,razor-coin/razor,alexandrcoin/vertcoin,gwangjin2/gwangcoin-core,coinkeeper/anoncoin_20150330_fixes,zzkt/solarcoin,DrCrypto/darkcoin,Czarcoin/czarcoin,bitgoldcoin-project/bitgoldcoin,koharjidan/litecoin,netswift/vertcoin,Cancercoin/Cancercoin,Dajackal/Ronpaulcoin,netswift/vertcoin,Czarcoin/czarcoin,mrtexaznl/mediterraneancoin,coinkeeper/2015-04-19_21-20_litecoindark,zebrains/Blotter,ronpaulcoin/ronpaulcoin,okinc/litecoin,nanocoins/mycoin,DrCrypto/darkcoin,ohac/sha1coin,Rav3nPL/doubloons-08,united-scrypt-coin-project/unitedscryptcoin,zzkt/solarcoin,Checkcoin/checkcoin,coinkeeper/2015-06-22_18-51_vertcoin,shapiroisme/datadollar,saydulk/Feathercoin,greencoin-dev/greencoin-dev,jiffe/cosinecoin,Cancercoin/Cancercoin,ohac/sha1coin,shapiroisme/datadollar,zebrains/Blotter,Coinfigli/coinfigli,Ziftr/litecoin,icook/vertcoin,coinkeeper/2015-06-22_18-46_razor,CrimeaCoin/crimeacoin,IlfirinCano/shavercoin,plankton12345/litecoin,privatecoin/privatecoin,micryon/GPUcoin,Electronic-Gulden-Foundation/egulden,novaexchange/EAC,ANCompany/birdcoin-dev,IlfirinIlfirin/shavercoin,richo/dongcoin,Electronic-Gulden-Foundation/egulden,ghostlander/Feathercoin,shadowoneau/ozcoin,bootycoin-project/bootycoin,kryptokredyt/ProjektZespolowyCoin,coinkeeper/2015-06-22_19-13_florincoin,marscoin/marscoin,ronpaulcoin/ronpaulcoin,stamhe/litecoin,oklink-dev/litecoin_block,IlfirinCano/shavercoin,qreatora/worldcoin-v0.8,kryptokredyt/ProjektZespolowyCoin,brightcoin/brightcoin,Coinfigli/coinfigli,Ziftr/litecoin,KaSt/equikoin,richo/dongcoin,Coinfigli/coinfigli,united-scrypt-coin-project/unitedscryptcoin,Anoncoin/anoncoin,ohac/sakuracoin,wekuiz/wekoin,qreatora/worldcoin-v0.8,Coinfigli/coinfigli,WorldcoinGlobal/WorldcoinLegacy,Ziftr/litecoin,coinkeeper/2015-06-22_18-46_razor,scamcoinz/scamcoin,coinkeeper/2015-06-22_19-19_worldcoin,cqtenq/Feathercoin,IlfirinIlfirin/shavercoin,ccoin-project/ccoin,marscoin/marscoin,shadowoneau/ozcoin,ghostlander/Feathercoin,worldcoinproject/worldcoin-v0.8,ghostlander/Feathercoin,bitgoldcoin-project/bitgoldcoin,coinkeeper/anoncoin_20150330_fixes,richo/dongcoin,ccoin-project/ccoin,Anoncoin/anoncoin,CrimeaCoin/crimeacoin,Rav3nPL/doubloons-08,shapiroisme/datadollar,enlighter/Feathercoin,worldcoinproject/worldcoin-v0.8,gwangjin2/gwangcoin-core,scamcoinz/scamcoin,richo/dongcoin,shurcoin/shurcoin,coinkeeper/2015-06-22_18-30_anoncoin,okinc/litecoin,cinnamoncoin/Feathercoin,plankton12345/litecoin,neutrinofoundation/neutrino-digital-currency,shapiroisme/datadollar,micryon/GPUcoin,brishtiteveja/sherlockholmescoin,Electronic-Gulden-Foundation/egulden,Dajackal/Ronpaulcoin,okinc/litecoin,Ziftr/litecoin,icook/vertcoin,brightcoin/brightcoin,zemrys/vertcoin,koharjidan/litecoin,Dajackal/Ronpaulcoin,coinkeeper/2015-06-22_18-30_anoncoin,Cancercoin/Cancercoin,vertcoin/eyeglass,enlighter/Feathercoin,Dajackal/Ronpaulcoin,WorldcoinGlobal/WorldcoinLegacy,worldcoinproject/worldcoin-v0.8,Electronic-Gulden-Foundation/egulden,mooncoin-project/mooncoin-landann,Tetcoin/tetcoin,qreatora/worldcoin-v0.8,Tetcoin/tetcoin,netswift/vertcoin,brightcoin/brightcoin,Dajackal/Ronpaulcoin,coinkeeper/2015-04-19_21-20_litecoindark,IlfirinCano/shavercoin,Rav3nPL/doubloons-08,mooncoin-project/mooncoin-landann,oklink-dev/litecoin_block,novaexchange/EAC,vertcoin/eyeglass,cqtenq/Feathercoin,vertcoin/eyeglass,ghostlander/Feathercoin,novaexchange/EAC,saydulk/Feathercoin,Bluejudy/worldcoin,Cancercoin/Cancercoin,jiffe/cosinecoin,shurcoin/shurcoin,koharjidan/litecoin,DrCrypto/darkcoin,Tetcoin/tetcoin,chrisfranko/aiden,degenorate/Deftcoin,degenorate/Deftcoin,Anoncoin/anoncoin,chrisfranko/aiden,cryptcoins/cryptcoin,ANCompany/birdcoin-dev,mrtexaznl/mediterraneancoin,alexandrcoin/vertcoin,coinkeeper/2015-06-22_19-19_worldcoin,netswift/vertcoin,privatecoin/privatecoin,Bluejudy/worldcoin,CrimeaCoin/crimeacoin,qreatora/worldcoin-v0.8,coinkeeper/2015-06-22_19-19_worldcoin,razor-coin/razor,ghostlander/Feathercoin,chrisfranko/aiden,Checkcoin/checkcoin,wekuiz/wekoin,cryptcoins/cryptcoin,ccoin-project/ccoin,brightcoin/brightcoin,coinkeeper/2015-06-22_19-19_worldcoin,nanocoins/mycoin,stamhe/litecoin,ohac/sha1coin,zebrains/Blotter,bitgoldcoin-project/bitgoldcoin,Litecoindark/LTCD,Rav3nPL/doubloons-08,coinkeeper/2015-06-22_19-19_worldcoin,earthcoinproject/earthcoin,kryptokredyt/ProjektZespolowyCoin,Anoncoin/anoncoin,CrimeaCoin/crimeacoin,greencoin-dev/greencoin-dev,zemrys/vertcoin,tensaix2j/bananacoin,bitgoldcoin-project/bitgoldcoin,shadowoneau/ozcoin,Checkcoin/checkcoin,shurcoin/shurcoin,Czarcoin/czarcoin,scamcoinz/scamcoin,oklink-dev/litecoin_block,privatecoin/privatecoin,coinkeeper/2015-06-22_18-51_vertcoin,IlfirinCano/shavercoin,coinkeeper/2015-06-22_18-30_anoncoin,richo/dongcoin,earthcoinproject/earthcoin,nanocoins/mycoin,neutrinofoundation/neutrino-digital-currency,micryon/GPUcoin,tensaix2j/bananacoin,Litecoindark/LTCD,mrtexaznl/mediterraneancoin,shadowoneau/ozcoin,scamcoinz/scamcoin,shurcoin/shurcoin,IlfirinIlfirin/shavercoin,privatecoin/privatecoin,cryptcoins/cryptcoin,brishtiteveja/sherlockholmescoin,shadowoneau/ozcoin,mooncoin-project/mooncoin-landann,okinc/litecoin,DrCrypto/darkcoin,cinnamoncoin/Feathercoin,degenorate/Deftcoin,ohac/sakuracoin,razor-coin/razor,coinkeeper/2015-06-22_19-13_florincoin,cinnamoncoin/Feathercoin,Litecoindark/LTCD,brightcoin/brightcoin,mrtexaznl/mediterraneancoin,bootycoin-project/bootycoin,wekuiz/wekoin,saydulk/Feathercoin,KaSt/equikoin,wekuiz/wekoin,coinkeeper/2015-06-22_19-13_florincoin,icook/vertcoin,ANCompany/birdcoin-dev,qreatora/worldcoin-v0.8,coinkeeper/2015-06-22_19-13_florincoin,ohac/sakuracoin,WorldcoinGlobal/WorldcoinLegacy,KaSt/equikoin,gwangjin2/gwangcoin-core,wekuiz/wekoin,kryptokredyt/ProjektZespolowyCoin,alexandrcoin/vertcoin,Bluejudy/worldcoin,koharjidan/litecoin,cinnamoncoin/Feathercoin,zzkt/solarcoin,coinkeeper/2015-06-22_18-51_vertcoin,degenorate/Deftcoin,Electronic-Gulden-Foundation/egulden,razor-coin/razor,brishtiteveja/sherlockholmescoin,jiffe/cosinecoin,greencoin-dev/greencoin-dev,bootycoin-project/bootycoin,coinkeeper/2015-04-19_21-20_litecoindark,micryon/GPUcoin,gwangjin2/gwangcoin-core,nanocoins/mycoin,Bluejudy/worldcoin,enlighter/Feathercoin,ANCompany/birdcoin-dev,saydulk/Feathercoin,Bluejudy/worldcoin,oklink-dev/litecoin_block,united-scrypt-coin-project/unitedscryptcoin,Checkcoin/checkcoin,zemrys/vertcoin,dakk/soundcoin,united-scrypt-coin-project/unitedscryptcoin,zemrys/vertcoin,zzkt/solarcoin,brishtiteveja/sherlockholmescoin,cryptcoins/cryptcoin,alexandrcoin/vertcoin,greencoin-dev/greencoin-dev,Checkcoin/checkcoin,tensaix2j/bananacoin,Rav3nPL/doubloons-08,IlfirinIlfirin/shavercoin,coinkeeper/2015-06-22_19-13_florincoin,tensaix2j/bananacoin,worldcoinproject/worldcoin-v0.8,cryptcoins/cryptcoin,Czarcoin/czarcoin,ronpaulcoin/ronpaulcoin,cqtenq/Feathercoin,privatecoin/privatecoin,Electronic-Gulden-Foundation/egulden,koharjidan/litecoin,netswift/vertcoin,enlighter/Feathercoin,oklink-dev/litecoin_block,novaexchange/EAC,gwangjin2/gwangcoin-core,united-scrypt-coin-project/unitedscryptcoin,chrisfranko/aiden,shapiroisme/datadollar,marscoin/marscoin,coinkeeper/2015-06-22_18-30_anoncoin,icook/vertcoin,coinkeeper/2015-06-22_18-51_vertcoin,IlfirinCano/shavercoin,enlighter/Feathercoin,chrisfranko/aiden,marscoin/marscoin,ohac/sakuracoin,Anoncoin/anoncoin,KaSt/equikoin,shurcoin/shurcoin,okinc/litecoin,marscoin/marscoin,Coinfigli/coinfigli,worldcoinproject/worldcoin-v0.8,ronpaulcoin/ronpaulcoin,coinkeeper/2015-04-19_21-20_litecoindark,dakk/soundcoin,neutrinofoundation/neutrino-digital-currency,novaexchange/EAC,neutrinofoundation/neutrino-digital-currency,zemrys/vertcoin,bitgoldcoin-project/bitgoldcoin,ronpaulcoin/ronpaulcoin,IlfirinIlfirin/shavercoin,cqtenq/Feathercoin,jiffe/cosinecoin,Tetcoin/tetcoin,coinkeeper/anoncoin_20150330_fixes,zebrains/Blotter,ccoin-project/ccoin,ohac/sha1coin,dakk/soundcoin,coinkeeper/2015-06-22_18-46_razor,tensaix2j/bananacoin,greencoin-dev/greencoin-dev,CrimeaCoin/crimeacoin,cinnamoncoin/Feathercoin,KaSt/equikoin,plankton12345/litecoin,netswift/vertcoin,plankton12345/litecoin,Litecoindark/LTCD,dakk/soundcoin,marscoin/marscoin,plankton12345/litecoin,zebrains/Blotter,degenorate/Deftcoin,coinkeeper/2015-06-22_18-46_razor,stamhe/litecoin,WorldcoinGlobal/WorldcoinLegacy,coinkeeper/2015-06-22_18-51_vertcoin,coinkeeper/2015-06-22_18-46_razor,brishtiteveja/sherlockholmescoin,earthcoinproject/earthcoin,micryon/GPUcoin,ohac/sha1coin,earthcoinproject/earthcoin,zemrys/vertcoin,Tetcoin/tetcoin,icook/vertcoin,mrtexaznl/mediterraneancoin,stamhe/litecoin,earthcoinproject/earthcoin,WorldcoinGlobal/WorldcoinLegacy,cqtenq/Feathercoin,mooncoin-project/mooncoin-landann,saydulk/Feathercoin,razor-coin/razor,Czarcoin/czarcoin,Cancercoin/Cancercoin,ohac/sakuracoin,coinkeeper/2015-06-22_18-30_anoncoin,vertcoin/eyeglass