Refactor CSimpleFileCache::WaitData, kill race conditions.

by review cache code, I found a little place need be fixed:
It's related the CSimpleFileCache::WaitData function, it check available bytes and if not enough, wait for specified msec for the data, else timeout.

in the current code, there are at least 5 places has problem:
1. the comment for waiting m_hDataAvailEvent is not correct, it said 'busy look (sleep max 1 sec each round)', but indeed it sleep at least 1 second
2. the return code when wait m_hDataAvailEvent timed out is also wrong, CACHE_RC_ERROR should not be used here.
3. it exists some race condition will return timeout even if data is enough, e.g. when msec is very small but greater than 0.
4. if m_hDataAvailEvent set and wait return true, it loop back, but if when the left msec is 0, the code will not check available bytes and just return timeout, it's another race condition.
5. the m_hDataAvailEvent was set after write position updated in CSimpleFileCache::WriteToCache, it introduces race condition, e.g. event set, but in the wait side, in WriteToCache, it may found the data is still not available (if the left msec > 0, else hit problem No. 4), since the write position maybe not updated yet.

anyway, I can not see what the original code want to do, it mixed by the miss-matched comment, wrong return code, race condition from here to there, but I did known what the method need to do, then I refactored the method related code, make the method do the work without surprise, here it is.