如何阻止读/写远程文件系统 [英] How non blocking read/write throught remote FileSystem

查看:140
本文介绍了如何阻止读/写远程文件系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法在远程文件系统(例如NFS,SSHFS或sambafs)
上读写文件,甚至是打开时立即返回一个错误代码?
实际上,我使用的是Twisted,我想知道是否有一种安全的方式来访问远程文件,而不会阻塞我的反应堆。 解决方案在Twisted中,对于远程文件系统,就像其他阻塞调用一样,可以使用 threads.deferToThread - 处理麻烦的阻塞系统调用的一个合理的优雅的方式! - )


Is there a way to write and read files on a remote filesystem (such as NFS, SSHFS, or sambafs) in a way that read or write or even open return immediately with an error code? In fact I'm using Twisted and I want to know whether there is a safe way to access remote files without blocking my reactor.

解决方案

In Twisted, for remote filesystems just like for any other blocking calls, you can use threads.deferToThread -- a reasonably elegant way to deal with pesky blocking syscalls!-)

这篇关于如何阻止读/写远程文件系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆