Browse Source

Cleanup

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1405 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.62
sletz 18 years ago
parent
commit
5900be9a1e
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      common/JackAtomicArrayState.h

+ 4
- 4
common/JackAtomicArrayState.h View File

@@ -63,7 +63,7 @@ Requirement:
- several possible "pending" state
- an TrySwitchState(int state) operation to atomically switch a "pending" to the "current" state (the pending becomes the current).
The TrySwitchState operation returns a "current" state (either the same if switch fails or the new one; one can know if the switch has succeeded)
The TrySwitchState operation returns a "current" state (either the same if switch fails or the new one, one can know if the switch has succeeded)
- a WriteNextStartState(int state) returns a "pending" state to be written into
- a WriteNextStartStop(int state) make the written "pending" state become "switchable"
@@ -72,7 +72,7 @@ Requirement:
GetCurrentIndex() *must* return an increasing value to be able to check reading current state coherency
The fCounter is an array of indexes to access te current and 3 different "pending" states.
The fCounter is an array of indexes to access the current and 3 different "pending" states.
¥ WriteNextStateStart(int index) must return a valid state to be written into, and must invalidate state "index" ==> cur state switch.
¥ WriteNextStateStop(int index) makes the "index" state become "switchable" with the current state.
@@ -113,8 +113,8 @@ class JackAtomicArrayState
*result = GetIndex1(new_val, state);
cur_index = GetIndex1(new_val, 0);
next_index = SwapIndex1(fCounter, state);
need_copy = (GetIndex1(new_val, state) == 0); // Written = false, switch just occured
SetIndex1(new_val, state, 0); // Written = false, invalidate state
need_copy = (GetIndex1(new_val, state) == 0); // Written = false, switch just occured
SetIndex1(new_val, state, 0); // Written = false, invalidate state
} while (!CAS(Counter1(old_val), Counter1(new_val), (UInt32*)&fCounter));
if (need_copy)
memcpy(&fState[next_index], &fState[cur_index], sizeof(T));


Loading…
Cancel
Save