You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-07-29 08:21:15 +03:00
Checkpointing, not ready to build yet.
This commit is contained in:
42
utils/cloudio/SocketPool.h
Normal file
42
utils/cloudio/SocketPool.h
Normal file
@ -0,0 +1,42 @@
|
||||
// copy licensing stuff here
|
||||
|
||||
#ifndef _SOCKETPOOL_H_
|
||||
#define _SOCKETPOOL_H_
|
||||
|
||||
#include <boost/utility.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
||||
#include "bytestream.h"
|
||||
|
||||
namespace idbdatafile
|
||||
{
|
||||
|
||||
class SocketPool : public boost::noncopyable
|
||||
{
|
||||
public:
|
||||
SocketPool();
|
||||
|
||||
// the dtor will immediately close all sockets
|
||||
virtual ~SocketPool();
|
||||
|
||||
// 0 = success, -1 = failure. Should this throw instead?
|
||||
int send_recv(const ByteStream &to_send, ByteStream *to_recv);
|
||||
|
||||
private:
|
||||
int getSocket();
|
||||
void returnSocket();
|
||||
|
||||
std::vector<int> allSockets;
|
||||
std::deque<int> freeSockets;
|
||||
boost::mutex mutex;
|
||||
boost::condition socketAvailable;
|
||||
int clientSocket;
|
||||
int maxSockets;
|
||||
static const int defaultSockets = 20;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user