gregory p smith amuhkryptoorg tue apr 1 2008 509 pm guido van rossum wrote something keeps awake night aware solution counter seems fine except think perhaps close call raise ioerror instead set flag thread makes counter go zero close thread file got closed used raising ioerror right thing problem calling close file implies close actually completed os returns call return file object actually closed underlying layers cant leave later done one currently operating threads violate close semantics lose direct indication error occurred close course concurrency issues besides close two threads try io file c stdio library case stdio files threadsafe c level classically contradicting think problem perhaps io operation disallowed file use another thread sound like safest thing gps wed 06 aug 2008 221016 0700 pythondev threadsafe file objects return