Non-blocking file access with Twisted

前端 未结 5 1654
故里飘歌
故里飘歌 2020-12-18 17:44

I\'m trying to figure out if there is a defacto pattern for file access using twisted. Lots of examples I\'ve looked at (twisted.python.log, twisted.persisted.dirdbm, twiste

5条回答
  •  猫巷女王i
    2020-12-18 18:23

    The fdesc module might be useful for asynchronously talking to a socket or pipe, but when given an fd that refers to an ordinary filesystem file, it does blocking io (and via a rather odd interface at that). For disk io, fdesc is effectively snake oil; don't use it.

    As of May 2017, the only reasonable way to get async disk io in twisted is by wrapping synchronous io calls in a deferToThread.

提交回复
热议问题