How to grant read-only (non-copy) access to an object in another process in Cython?

馋奶兔 提交于 2019-12-23 04:44:32

问题


How to grant read-only (non-copy) access to an object in one process to another process?

For example, in the diagram below, how to grant Process 2 and Process 3 access to the class Tasks which is in Process 1?

Process 1 is the only process which will write to the class Tasks and it is not important to maintain any state about which tasks have been processed etc.

Process 2                     Process 1                      Process 3
+-------------------+         +-------------------+          +-------------------+
|                   |         |                   |          |                   |
| Perform job A for | <----------+ class Tasks +-----------> | Perform job B for |
| task in Tasks     |         |                   |          | task in Tasks     |
|                   |         |                   |          |                   |
|                   |         |                   |          |                   |
|                   |         |                   |          |                   |
|                   |         |                   |          |                   |
|                   |         |                   |          |                   |
|                   |         |                   |          |                   |
|                   |         |                   |          |                   |
|                   |         |                   |          |                   |
|                   |         |                   |          |                   |
+-------------------+         +-------------------+          +-------------------+

I think this tasks may involve using pointers? Cython's documentation is brief on parallelism.

How to give Process 2 and Process 3 read-only, non-copy access to the class Tasks which is in Process 1?

来源:https://stackoverflow.com/questions/49872179/how-to-grant-read-only-non-copy-access-to-an-object-in-another-process-in-cyth

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!