Hi guys,
I'm writing an actor where I'm offloading a long task to its helper loop. That task needs access to the values of the actor's current private data, and then the actor needs to change private data depending on the results of the long analysis and the current private data.
My understanding is that actors are by value classes maintained in a shift register of actor core. Therefore in an actor's helper loop, which I create, I shouldn't make a second shift register with the actor's class wire -- that would create a copy of the actor's private data with all the potential bugs associated.
My issue is, within the helper loop's event I need access to the up to date private data of the actor's class. Now I thought about sending copies of the actor's private data when the event fires, but that has concurrency issues (if multiple such events are fired, and the first one modifies the private data the subsequent events will be making decisions based on stale data since I sent copies).
Do I want to send a reference to the actor's private data to the helper loop? Is that an Ok design within AF? I'm a little hesitant of that solution b/c now I have two things which might modify the actor's private data but maybe since helper loops are within actor its still "encapsulation". Not really sure...