Files
racket-webview-qt/shmqueue.h
2026-04-11 09:50:59 +02:00

53 lines
794 B
C++

#ifndef SHMQUEUE_H
#define SHMQUEUE_H
#include "shm.h"
#include <string>
typedef struct __ShmQueueItem__
{
int cmd;
ShmPlace data_place;
ShmPlace next;
ShmPlace prev;
} ShmQueueItem;
typedef struct __ShmQueue_
{
ShmPlace first;
ShmPlace last;
int count;
} ShmQueueStart;
class ShmQueue
{
private:
Shm *_shm;
private:
ShmQueueStart *_queue;
ShmSem *_queue_sem;
bool _owner;
private:
void cleanup();
public:
int depth();
public:
bool dequeue(int &cmd, std::string &json_data, int wait_ms = 0);
void enqueue(int cmd, const std::string &json_data);
void enqueue(int cmd);
public:
void takeOwnership();
public:
ShmQueue(Shm *shm, ShmSlot slot, bool owner);
~ShmQueue();
};
#endif // SHMQUEUE_H