28 lines
643 B
C++
28 lines
643 B
C++
// Copyright (2019-2023) Paul Scherrer Institute
|
|
|
|
#ifndef JUNGFRAUJOCH_ZEROCOPYRETURNVALUE_H
|
|
#define JUNGFRAUJOCH_ZEROCOPYRETURNVALUE_H
|
|
|
|
#include "ThreadSafeFIFO.h"
|
|
|
|
class ZeroCopyReturnValue {
|
|
void *ptr;
|
|
uint32_t handle;
|
|
ThreadSafeFIFO<uint32_t> *fifo;
|
|
public:
|
|
ZeroCopyReturnValue(void *in_ptr,
|
|
ThreadSafeFIFO<uint32_t> &in_fifo,
|
|
uint32_t in_handle) :
|
|
ptr(in_ptr), fifo(&in_fifo), handle(in_handle) {}
|
|
|
|
void *get_ptr() const {
|
|
return ptr;
|
|
}
|
|
|
|
void release() const {
|
|
fifo->PutBlocking(handle);
|
|
}
|
|
};
|
|
|
|
#endif //JUNGFRAUJOCH_ZEROCOPYRETURNVALUE_H
|