ZeroCopyReturnValue: Reset status properly
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
#include "ThreadSafeFIFO.h"
|
||||
|
||||
ZeroCopyReturnValue::ZeroCopyReturnValue(void *in_ptr, ImageBuffer &in_ctrl, uint32_t in_handle)
|
||||
: ptr(in_ptr), payload_size(0), image_number(-1), buf_ctrl(in_ctrl), handle(in_handle),
|
||||
indexed(false) {
|
||||
: ptr(in_ptr), payload_size(0), image_number(-1), buf_ctrl(in_ctrl), handle(in_handle),
|
||||
indexed(false) {
|
||||
}
|
||||
|
||||
void ZeroCopyReturnValue::SetImageNumber(int64_t in_image_number) {
|
||||
@@ -23,20 +23,21 @@ size_t ZeroCopyReturnValue::GetImageSize() const {
|
||||
return payload_size;
|
||||
}
|
||||
|
||||
void * ZeroCopyReturnValue::GetImage() const {
|
||||
void *ZeroCopyReturnValue::GetImage() const {
|
||||
return ptr;
|
||||
}
|
||||
|
||||
void ZeroCopyReturnValue::release() {
|
||||
if (status == ImageBufferEntryStatus::InPreparation)
|
||||
ReadyToSend();
|
||||
if (status == ImageBufferEntryStatus::InPreparation)
|
||||
ReadyToSend();
|
||||
|
||||
if (status == ImageBufferEntryStatus::Sending) {
|
||||
buf_ctrl.ReleaseSlot(handle);
|
||||
} else {
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"Trying to send image that is not in preparation");
|
||||
}
|
||||
if (status == ImageBufferEntryStatus::Sending) {
|
||||
buf_ctrl.ReleaseSlot(handle);
|
||||
status = ImageBufferEntryStatus::InPreparation;
|
||||
} else {
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid,
|
||||
"Trying to send image that is not in preparation");
|
||||
}
|
||||
}
|
||||
|
||||
int64_t ZeroCopyReturnValue::GetImageNumber() const {
|
||||
|
||||
Reference in New Issue
Block a user