Commit 01e6527c authored by Sebastien Petitdemange's avatar Sebastien Petitdemange

Merge branch 'fix_core-1.7' into 'core-1.7'

Apply upstream fixes to core-1.7

See merge request !17
parents cb35d0f3 2311e25a
......@@ -890,15 +890,14 @@ endif
ifneq ($(COMPILE_HEXITEC),0)
HEXITEC_LDFLAGS := $(LDFLAGS) -L/opt/pleora/ebus_sdk/CentOS-RHEL-7-x86_64/lib
HEXITEC_LDLIBS := $(LDLIBS) -lPvDevice -lPvStream -lPvBuffer -lPvGenICam -lPvBase -lPvSerial -lEbUtilsLib
HEXITEC_LDFLAGS := -L/opt/pleora/ebus_sdk/CentOS-RHEL-7-x86_64/lib
HEXITEC_LDLIBS := -lPvDevice -lPvStream -lPvBuffer -lPvGenICam -lPvBase -lPvSerial -lEbUtilsLib
hexitec-name := hexitec
hexitec-objs := ../camera/hexitec/src/Hexitec.o
hexitec-ver := ../camera/hexitec/VERSION
hexitec-flags := $(HEXITEC_LDFLAGS)
hexitec-deps := $(HEXITEC_LDLIBS)
hexitec-flags := $(LDFLAGS) $(HEXITEC_LDFLAGS)
hexitec-deps := $(LDLIBS) $(HEXITEC_LDLIBS)
$(call lib-full,$(hexitec-name),$(hexitec-ver)): $(hexitec-objs)
$(call compile-lib,$(hexitec-name),$(hexitec-ver),$(hexitec-flags),$(hexitec-deps),$@,$+)
......
......@@ -103,12 +103,12 @@ private:
{
public:
AutoLockData(M& mutex, int state=Locked)
: m(mutex), l(false), ul_at_end(true)
: m(mutex), l(0), ul_at_end(true)
{
switch (state) {
case Locked: lock(); break;
case TryLocked: tryLock(); break;
case PrevLocked: l = true; break;
case PrevLocked: l = 1; break;
default: break;
}
}
......@@ -132,19 +132,22 @@ private:
void lock()
{
m.lock();
l = true;
if (!l++)
m.lock();
}
void unlock()
{
m.unlock();
l = false;
if (!--l)
m.unlock();
}
bool tryLock()
{
l = m.tryLock();
if (!l)
l = m.tryLock();
else
l++;
return l;
}
......@@ -162,7 +165,7 @@ private:
private:
AutoCounter c;
M& m;
bool l;
char l;
bool ul_at_end;
};
......@@ -180,6 +183,26 @@ private:
};
template <class M>
class AutoUnlock
{
public:
AutoUnlock(const AutoUnlock& o)
: l(o.l)
{ l.unlock(); }
AutoUnlock(AutoLock<M>& p)
: l(p)
{ l.unlock(); }
~AutoUnlock()
{ l.lock(); }
private:
AutoLock<M>& l;
};
/********************************************************************
* AutoPtr
********************************************************************/
......
......@@ -78,6 +78,7 @@ class LIMACORE_API Mutex
typedef AutoLock<Mutex> AutoMutex;
typedef AutoUnlock<Mutex> AutoMutexUnlock;
class LIMACORE_API Cond
{
......
......@@ -122,11 +122,12 @@ MemBuffer::MemBuffer(int size)
__m128i zero = _mm_setzero_si128();
for(long i = 0;i < size;i += page_size,ptr+=page_size)
{
if(size_t(size - page_size) > sizeof(__m128i))
if(size_t(size - i) >= sizeof(__m128i))
_mm_store_si128((__m128i*)ptr,zero);
else
*ptr = 0;
}
_mm_empty();
}
else
{
......@@ -150,10 +151,11 @@ MemBuffer::MemBuffer(const MemBuffer& buffer)
MemBuffer::~MemBuffer()
{
if (!m_size)
throw LIMA_COM_EXC(Error, "Deleting empty buffer");
release();
}
void MemBuffer::alloc(int size)
{
if (m_size == size)
......@@ -183,7 +185,7 @@ void MemBuffer::copy(const MemBuffer& buffer)
void MemBuffer::release()
{
if (!m_size)
if (!m_size)
return;
#ifdef __unix
......
......@@ -1089,25 +1089,21 @@ long CtControl::_increment_image_cnt(Data& aData,
long image_cnt,SortedDataType& cnt)
{
long expectedImageCnt = image_cnt + 1;
if(aData.frameNumber == expectedImageCnt)
if(aData.frameNumber != expectedImageCnt)
{
while(!cnt.empty())
{
SortedDataType::iterator i = cnt.begin();
long nextExpectedImageCnt = expectedImageCnt + 1;
if(nextExpectedImageCnt == i->frameNumber)
{
expectedImageCnt = nextExpectedImageCnt;
cnt.erase(i);
}
else
break;
}
return expectedImageCnt;
cnt.insert(aData);
return image_cnt;
}
else
cnt.insert(aData);
return image_cnt;
while(!cnt.empty())
{
SortedDataType::iterator i = cnt.begin();
if(i->frameNumber != expectedImageCnt + 1)
break;
expectedImageCnt = i->frameNumber;
cnt.erase(i);
}
return expectedImageCnt;
}
/** @brief inc the save counter.
......
Subproject commit c80632d5298bd81c4feb7cca52f7619884d9371e
Subproject commit 2e73791fc23e95d0aec96fadca998784499a9e48
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment