<s> import threading <EOL> _locals = threading . local ( ) <EOL> def pin_thread ( ) : <EOL> """<STR_LIT>""" <EOL> _locals . pinned = True <EOL> def unpin_thread ( ) : <EOL> """<STR_LIT>""" <EOL> if getattr ( _locals , '<STR_LIT>' , False ) : <EOL> del _locals . pinned <EOL> def thread_is_pinned ( ) : <EOL> """<STR_LIT>""" <EOL> return getattr ( _locals , '<STR_LIT>' , False ) <EOL> def set_db_write ( ) : <EOL> """<STR_LIT>""" <EOL> _locals . db_write = True <EOL> def clear_db_write ( ) : <EOL> if getattr ( _locals , '<STR_LIT>' , False ) : <EOL> del _locals . db_write <EOL> def db_was_written ( ) : <EOL> """<STR_LIT>""" <EOL> return getattr ( _locals , '<STR_LIT>' , False ) </s>
