diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2007-05-25 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:51 +0300 |
commit | c574fc0f4bba94e693b0e22f730d355b75d4f4ce (patch) | |
tree | da4ebd90c776d508ac679d50492f29461db80be0 /CPP/7zip/Common/InMemStream.h | |
parent | a145bfc7cf17f7bbcfae8f0064333c8ea75b455c (diff) |
4.46 beta
Diffstat (limited to 'CPP/7zip/Common/InMemStream.h')
-rwxr-xr-x | CPP/7zip/Common/InMemStream.h | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/CPP/7zip/Common/InMemStream.h b/CPP/7zip/Common/InMemStream.h index fcd0092d..73f344ee 100755 --- a/CPP/7zip/Common/InMemStream.h +++ b/CPP/7zip/Common/InMemStream.h @@ -82,11 +82,12 @@ class CResourceListMt: public CResourceList public: NWindows::NSynchronization::CSemaphore Semaphore; - bool AllocateList(int numItems) + HRes AllocateList(int numItems) { if (!CResourceList::AllocateList(numItems)) return false; - return Semaphore.Create((LONG)numItems, (LONG)numItems); + Semaphore.Close(); + return Semaphore.Create(numItems, numItems); } int AllocateItem() @@ -118,15 +119,15 @@ public: CIntQueueMt(): _numItems(0), _head(0), _cur(0) {} NWindows::NSynchronization::CSemaphore Semaphore; - bool AllocateList(int numItems) + HRes AllocateList(int numItems) { FreeList(); if (numItems == 0) - return true; + return S_OK; if (!CIntListCheck::AllocateList(numItems)) - return false; + return E_OUTOFMEMORY; _numItems = numItems; - return Semaphore.Create((LONG)0, (LONG)numItems); + return Semaphore.Create(0, numItems); } void FreeList() @@ -142,10 +143,8 @@ public: _data[_head++] = value; if (_head == _numItems) _head = 0; - LONG previousCount; - Semaphore.Release(1, &previousCount); + Semaphore.Release(); // printf("\nRelease prev = %d\n", previousCount); - } int GetItem() @@ -253,7 +252,7 @@ public: // to stop reading you must implement // returning Error in IInMemStreamMtCallback::AllocateBlock // and then you must free at least one substream - bool StartReadThread(); + HRes StartReadThread(); void Free(); |