释放另一个进程占用的资源
在 SimPy 中,如果我已处理 a
、b
和资源 r
并执行以下操作:
yield request, self, r #request done in process a
如何从进程 b 释放资源?
yield release, a, r #release done in b (being a an instance of class a), doesn't work
我也尝试过:
r.activeQ.remove(a)
它实际上从活动队列中删除,但是它不会执行执行 yield
时执行的所有隐式步骤,结果证明这是毫无意义的。
能做到吗?如果是,怎么办?
In SimPy, if I've process a
, b
and resource r
and do:
yield request, self, r #request done in process a
How can I release the resource from process b?
yield release, a, r #release done in b (being a an instance of class a), doesn't work
I've also tried:
r.activeQ.remove(a)
And it actually removes from the active queue, however it won't do all the implicit steps made when doing a yield
and it turns out to be kind of pointless.
Can it be done? if yes, how?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好吧,我的问题是进程 b 实际上处于非活动状态,因此任何yield 调用都会失败。
我想出的一个解决方法是
希望
这可以帮助任何遇到同样问题的人。
Well, my problem was process
b
was actually inactive and therefore anyyield
call would be unsuccessful.A workaround I came up with was
Where
Hope this can help anyone out there having the same problem.