#ifndef WS_RESOURCEPOOL_H
#define WS_RESOURCEPOOL_H
#include "../public/nsapi.h"
#include "config.h"
#include <pthread.h>
#ifdef __cplusplus
extern "C" {
#endif
typedef struct ResourceDataPrivate ResourceDataPrivate;
struct ResourceDataPrivate {
ResourceData data;
void *resdata;
};
struct ResourcePool {
pool_handle_t *pool;
ResourceType *type;
char *name;
void *data;
pthread_mutex_t lock;
pthread_cond_t available;
ResourceDataPrivate **resources;
size_t resalloc;
size_t numresources;
size_t numcreated;
int min;
int max;
};
int init_resource_pools(
void);
int resourcepool_new(ServerConfiguration *cfg, cxstring type, cxstring name, ConfigNode *node);
void resourcepool_destroy_resource(ResourceDataPrivate *res);
void resourcepool_destroy(ResourcePool *respool);
#ifdef __cplusplus
}
#endif
#endif