K
Kasper Middelboe Petersen
Hello,
I'm working on a CSP library. I have channels and communicate messages
between processes using these. I would really like to be able to
enforce the concepts of CSP by removing accesss to variables for one
process as its passed trough a channel to another somehow. I'm looking
for any ideas as to how to actually do this.
Just to examplify what I mean:
I have two processes, p1 and p2. They share a channel c of a datatype
d which p1 writes to and p2 reads from.
Now d could be very simple like a bool or int in which case copying
wouldnt be a real problem thus leaving p2 with its own copy of the
message that p1 does not in anyway have access to.
However more often than not it would be a larger datastructure which
would be passed as a pointer to avoid the overhead of copying. In this
case p1 ofcause passes a pointer trough the channel instead. Problem
is this means you have no problem accessing the same object from p1
after its send to p2 as the pointer remains valid.
My question is, anyone have any ideas how to invalidate the pointer p1
has after its been send to p2? I'm willing to take some performane
hits all though not so much as to having to force a copy on every
channel communication.
/Kasper
I'm working on a CSP library. I have channels and communicate messages
between processes using these. I would really like to be able to
enforce the concepts of CSP by removing accesss to variables for one
process as its passed trough a channel to another somehow. I'm looking
for any ideas as to how to actually do this.
Just to examplify what I mean:
I have two processes, p1 and p2. They share a channel c of a datatype
d which p1 writes to and p2 reads from.
Now d could be very simple like a bool or int in which case copying
wouldnt be a real problem thus leaving p2 with its own copy of the
message that p1 does not in anyway have access to.
However more often than not it would be a larger datastructure which
would be passed as a pointer to avoid the overhead of copying. In this
case p1 ofcause passes a pointer trough the channel instead. Problem
is this means you have no problem accessing the same object from p1
after its send to p2 as the pointer remains valid.
My question is, anyone have any ideas how to invalidate the pointer p1
has after its been send to p2? I'm willing to take some performane
hits all though not so much as to having to force a copy on every
channel communication.
/Kasper