Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'CPP/7zip/Common/InMemStream.h')
-rwxr-xr-xCPP/7zip/Common/InMemStream.h19
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();