freenode/#clasp - IRC Chatlog
Search
3:46:46
drmeister
I think anything that removes entries from the call history without coordinating it with the dispatch function will violate the integrity of the system. I saw plenty of that when I was getting everything to work.
3:50:01
drmeister
But it's late here and I'm heading to bed - my head will be clearer in the morning.
3:50:47
drmeister
I follow your suggestion to use CAS for the regular call history updates - thank you.
3:54:15
drmeister
I can set up the call history as a C++ atomic object and use compare_exchange_weak or compare_exchange_strong on it. http://en.cppreference.com/w/cpp/atomic/atomic/compare_exchange
5:05:14
beach
Here is an interesting scenario: Suppose some class C is updated. Now, all existing instances of C are obsolete. Suppose that two different threads T1 and T2 use the same obsolete instance (say O) as arguments to perhaps two different generic functions F1 and F2 respectively. Is it possible that the discriminating function of F1 has been updated, but that of F2 has not?
5:05:15
beach
If so, the following could happen: T2 runs the discriminating function, and the result is an accessor that goes directly to some slot, but then T2 is delayed, and T1 executes. The discriminating function of F1 fails, so T1 detects that O is obsolete. It now alters the contents of the slots of O. Now, T2 executes again and accesses the wrong slot of O, perhaps even outside of O.