1
0
mirror of https://github.com/danog/libtgvoip.git synced 2024-11-27 04:34:42 +01:00
libtgvoip/BlockingQueue.h
Grishka 697e250727 Finished moving things around, all classes are now in tgvoip
Replaced condition variables with semaphores
Audio device enumeration & selection on OS X and Windows
2017-04-28 14:17:56 +03:00

40 lines
834 B
C++

//
// libtgvoip is free and unencumbered public domain software.
// For more information, see http://unlicense.org or the UNLICENSE file
// you should have received with this source code distribution.
//
#ifndef LIBTGVOIP_BLOCKINGQUEUE_H
#define LIBTGVOIP_BLOCKINGQUEUE_H
#include <stdlib.h>
#include <list>
#include "threading.h"
using namespace std;
namespace tgvoip{
class BlockingQueue{
public:
BlockingQueue(size_t capacity);
~BlockingQueue();
void Put(void* thing);
void* GetBlocking();
void* Get();
unsigned int Size();
void PrepareDealloc();
void SetOverflowCallback(void (*overflowCallback)(void*));
private:
void* GetInternal();
list<void*> queue;
size_t capacity;
//tgvoip_lock_t lock;
Semaphore semaphore;
tgvoip_mutex_t mutex;
void (*overflowCallback)(void*);
};
}
#endif //LIBTGVOIP_BLOCKINGQUEUE_H