cc3200: Fix thread mutex's so threading works with interrupts.
cc3200: Fix thread mutex's so threading works with interrupts.

Running Python code on a hard interrupt is incompatible with having a GIL,
because most of the time the GIL will be held by the user thread when the
interrupt arrives.  Hard interrupts mean that we should process them right
away and hence can't wait until the GIL is released.

The problem with the current code is that a hard interrupt will try to
exit/enter the GIL while it is still held by the user thread, hence leading
to a deadlock.

This patch works around such a problem by just making GIL exit/enter a
no-op when in an interrupt context, or when interrupts are disabled.

See issue #2406.

alex-march/micropython,tobbad/micropython,selste/micropython,henriknelson/micropython,tuc-osg/micropython,hiway/micropython,hiway/micropython,kerneltask/micropython,hiway/micropython,selste/micropython,matthewelse/micropython,TDAbboud/micropython,swegener/micropython,oopy/micropython,AriZuu/micropython,MrSurly/micropython,chrisdearman/micropython,MrSurly/micropython-esp32,Timmenem/micropython,micropython/micropython-esp32,ryannathans/micropython,infinnovation/micropython,lowRISC/micropython,kerneltask/micropython,tralamazza/micropython,dmazzella/micropython,torwag/micropython,ryannathans/micropython,swegener/micropython,trezor/micropython,Timmenem/micropython,AriZuu/micropython,kerneltask/micropython,Peetz0r/micropython-esp32,pramasoul/micropython,Peetz0r/micropython-esp32,alex-robbins/micropython,tuc-osg/micropython,mhoffma/micropython,oopy/micropython,infinnovation/micropython,adafruit/circuitpython,toolmacher/micropython,mhoffma/micropython,pozetroninc/micropython,pfalcon/micropython,bvernoux/micropython,alex-march/micropython,deshipu/micropython,MrSurly/micropython-esp32,jmarcelino/pycom-micropython,hosaka/micropython,toolmacher/micropython,hiway/micropython,micropython/micropython-esp32,tobbad/micropython,deshipu/micropython,jmarcelino/pycom-micropython,pfalcon/micropython,PappaPeppar/micropython,micropython/micropython-esp32,alex-robbins/micropython,TDAbboud/micropython,chrisdearman/micropython,pfalcon/micropython,bvernoux/micropython,henriknelson/micropython,henriknelson/micropython,cwyark/micropython,puuu/micropython,matthewelse/micropython,torwag/micropython,dmazzella/micropython,tuc-osg/micropython,tuc-osg/micropython,adafruit/micropython,matthewelse/micropython,HenrikSolver/micropython,mhoffma/micropython,trezor/micropython,selste/micropython,swegener/micropython,dmazzella/micropython,PappaPeppar/micropython,infinnovation/micropython,TDAbboud/micropython,hosaka/micropython,jmarcelino/pycom-micropython,adafruit/circuitpython,HenrikSolver/micropython,swegener/micropython,SHA2017-badge/micropython-esp32,hosaka/micropython,adafruit/circuitpython,ryannathans/micropython,HenrikSolver/micropython,trezor/micropython,matthewelse/micropython,pozetroninc/micropython,pramasoul/micropython,jmarcelino/pycom-micropython,adafruit/micropython,pramasoul/micropython,Timmenem/micropython,micropython/micropython-esp32,mhoffma/micropython,alex-robbins/micropython,pfalcon/micropython,alex-march/micropython,infinnovation/micropython,MrSurly/micropython-esp32,tobbad/micropython,puuu/micropython,AriZuu/micropython,SHA2017-badge/micropython-esp32,PappaPeppar/micropython,jmarcelino/pycom-micropython,hiway/micropython,oopy/micropython,deshipu/micropython,dxxb/micropython,deshipu/micropython,MrSurly/micropython-esp32,swegener/micropython,matthewelse/micropython,micropython/micropython-esp32,pozetroninc/micropython,AriZuu/micropython,HenrikSolver/micropython,blazewicz/micropython,selste/micropython,Peetz0r/micropython-esp32,alex-march/micropython,lowRISC/micropython,AriZuu/micropython,hosaka/micropython,blazewicz/micropython,trezor/micropython,hosaka/micropython,oopy/micropython,MrSurly/micropython,TDAbboud/micropython,chrisdearman/micropython,cwyark/micropython,lowRISC/micropython,dxxb/micropython,tralamazza/micropython,tobbad/micropython,dxxb/micropython,tralamazza/micropython,blazewicz/micropython,cwyark/micropython,PappaPeppar/micropython,adafruit/micropython,chrisdearman/micropython,lowRISC/micropython,toolmacher/micropython,bvernoux/micropython,SHA2017-badge/micropython-esp32,adafruit/micropython,SHA2017-badge/micropython-esp32,lowRISC/micropython,bvernoux/micropython,adafruit/circuitpython,PappaPeppar/micropython,tralamazza/micropython,Peetz0r/micropython-esp32,toolmacher/micropython,pozetroninc/micropython,pozetroninc/micropython,Peetz0r/micropython-esp32,MrSurly/micropython,SHA2017-badge/micropython-esp32,dxxb/micropython,henriknelson/micropython,puuu/micropython,ryannathans/micropython,TDAbboud/micropython,dmazzella/micropython,adafruit/circuitpython,HenrikSolver/micropython,cwyark/micropython,kerneltask/micropython,oopy/micropython,henriknelson/micropython,trezor/micropython,dxxb/micropython,ryannathans/micropython,MrSurly/micropython-esp32,Timmenem/micropython,alex-robbins/micropython,toolmacher/micropython,pramasoul/micropython,tuc-osg/micropython,torwag/micropython,kerneltask/micropython,tobbad/micropython,MrSurly/micropython,MrSurly/micropython,torwag/micropython,pramasoul/micropython,bvernoux/micropython,Timmenem/micropython,infinnovation/micropython,blazewicz/micropython,cwyark/micropython,blazewicz/micropython,adafruit/circuitpython,alex-march/micropython,alex-robbins/micropython,mhoffma/micropython,selste/micropython,matthewelse/micropython,puuu/micropython,torwag/micropython,pfalcon/micropython,puuu/micropython,deshipu/micropython,adafruit/micropython,chrisdearman/micropython