强制资源释放

huangapple go评论62阅读模式
英文:

Forced Resources release

问题

我有两个并行流:第一个通过生成一个属于种群2的代理来驱动第二个流,通过分裂来实现。复制代理与原始代理共享一个识别码。
我希望当原始代理离开流1时,立即将复制从流2中移除。
我想要做的是强制从种群2中移除复制代理(手动执行remove_pop2()),迫使它释放到目前为止占用的所有资源。
是否可以通过“On_remove”函数来实现这一点,还是需要代理切换到seize块?
附上两个流的图片。
谢谢!
强制资源释放

英文:

I have two parallel streams: the first drives the second by generating an agent belonging to population 2 via a split. The copy agent shares an identification code with the original agent.
In this way I would like that the moment the original agent leaves stream 1, immediately the copy is removed from flow 2.
What I would like to do is force the removal of the copy agent from population 2 (manually remove_pop2()), forcing it to release all the resources taken up to that point.
There is the possibility to do this with a "On_remove" function or it is necessary for the agent to switch to a block of seize.
Attached image of the two streams.
Thank you!
强制资源释放

答案1

得分: 0

你可以在销毁之前将其发送到一个单独的流程图中。在其中添加一个释放所有占用资源的“释放”模块。之后,在“接收器”中终止代理。

拖入这些模块:进入释放接收器

无论你现在在哪里终止代理,都不要这样做。相反,使用类似 enter.take(agent); 的方式将其发送到进入模块。

英文:

You can send it to a separate flow chart before destroying it. In it, add a Release block that releases all seized resources. After that, kill the agent in a Sink.

Drag in these blocks: Enter, Release, Sink.

Where ever you kill the agent now, don't. Instead, make it go to to the Enter block using something like enter.take(agent);.

huangapple
  • 本文由 发表于 2023年6月22日 18:10:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76530814.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定