Subject: Your ExpressRewards (New At CVS)

From: CVS Card Rewards <[email-masked]>
Date: Wed, 06 Aug 2014 08:57:01 -0700

Posted: August 05, 2014 | Re: Your Home Payment

Updated For August--
Please calculate your new rate-savings: It only takes (5) minutes.

(Calculated-Savings: TBD)
/ http://www.horsesgas.com/FHA-home/hud-appr-us-6354345.html

Calculating your new payment is simple with the official rate calculator. You will be able to see your exact-savings in under 5 minutes.

Regards,
US Rate (FHA Team)

This important message is sent form- US Rate Association | 9306 BOVA CT-Louiseville, KY 4 0 2 9 1 http://www.horsesgas.com/hme/ or you can write. This message should be deleted immediately if you are  not the intended recipient. [#0776968#]

- - - - - - - - - - - - - - - - - - - - - - - - - -

-End Communication Update-
For internal use only::

Home | Housing | HARP-2.0

Are we talking about raw C arrays? And are we talking about removing the last item or at arbitrary positions?   leemes Jul 10 at 17:12 
2	 	
The point I'm asking is: when during every point of time while the change is taking place, the array will be consistent, then it is not going to be a problem. But if you insert in the middle, you first move entries, leaving in an inconsistent state, and then insert the item. I hope this sheds some light on the problem.   leemes Jul 10 at 17:15
1	 	
Regarding iteration: it is important to not cache the size or an end iterator in the reading thread. I.e. don't use range-for. Also, the writing thread should update the size such that there is no inconsistent point in time. When inserting, first insert and then increase size. When removing, first decrease size then remove.   leemes Jul 10 at 17:16
4	 	
@leemes Good point, and one needs some sort of synchronization (a lock should do the trick; there may be a lockless alternative) to avoid this critical sequence being reordered by compiler or CPU. Edit: Coming to think of it, even that still permits the ordering (T1) read size, determine that index is in range; (T2) decrease size; (T2) invalidate the last element of the array. (T1) read last element based on index. Advise to OP: Just use a lock, none of us is smart enough to make the lockless thing work.   delnan Jul 10 at 17:21 
1	 	
@leemes C++ volatile (in contrast with Java volatile) has nothing to do with concurrency. It usually prevents some optimizations that can cause trouble for careless multithreading (e.g. eliding duplicate reads) but doesn't prevent movements w.r.t. other writes (such as the writes to the array), and doesn't affect the CPU's instruction reordering. An atomic or a memory barrier may help