问题
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