fix ozmod_sangoma_boost compilation and linking
git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@917 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
parent
4778d58223
commit
432a195053
|
@ -617,9 +617,7 @@ struct zap_io_interface {
|
|||
zio_api_t api;
|
||||
};
|
||||
|
||||
struct zap_queue;
|
||||
#define zap_queue_t struct zap_queue
|
||||
|
||||
typedef struct zap_queue zap_queue_t;
|
||||
typedef zap_status_t (*zap_queue_create_func_t)(zap_queue_t **queue, zap_size_t capacity);
|
||||
typedef zap_status_t (*zap_queue_enqueue_func_t)(zap_queue_t *queue, void *obj);
|
||||
typedef void *(*zap_queue_dequeue_func_t)(zap_queue_t *queue);
|
||||
|
|
|
@ -28,9 +28,9 @@ extern "C" {
|
|||
typedef void (*zap_func_ptr_t) (void);
|
||||
typedef void * zap_dso_lib_t;
|
||||
|
||||
void zap_dso_destroy(zap_dso_lib_t *lib);
|
||||
zap_dso_lib_t zap_dso_open(const char *path, char **err);
|
||||
void *zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err);
|
||||
OZ_DECLARE(void) zap_dso_destroy(zap_dso_lib_t *lib);
|
||||
OZ_DECLARE(zap_dso_lib_t) zap_dso_open(const char *path, char **err);
|
||||
OZ_DECLARE(void *) zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -63,7 +63,9 @@
|
|||
/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="openzap.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(OutDir)""
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"
|
||||
|
|
|
@ -1374,14 +1374,19 @@ static sangomabc_event_t *zap_boost_read_event(zap_span_t *span)
|
|||
mcon = &sangoma_boost_data->mcon;
|
||||
pcon = &sangoma_boost_data->pcon;
|
||||
|
||||
if (sangoma_boost_data->sigmod || FD_ISSET(pcon->socket, &sangoma_boost_data->rfds)) {
|
||||
if (sangoma_boost_data->sigmod
|
||||
#ifndef WIN32
|
||||
|| FD_ISSET(pcon->socket, &sangoma_boost_data->rfds)
|
||||
#endif
|
||||
) {
|
||||
event = sangomabc_connection_readp(pcon, sangoma_boost_data->iteration);
|
||||
}
|
||||
|
||||
#ifndef WIN32
|
||||
/* if there is no event and this is not a sigmod-driven span it's time to try the other connection for events */
|
||||
if (!event && !sangoma_boost_data->sigmod && FD_ISSET(mcon->socket, &sangoma_boost_data->rfds)) {
|
||||
event = sangomabc_connection_readp(mcon, sangoma_boost_data->iteration);
|
||||
}
|
||||
#endif
|
||||
return event;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="../../../src/include;../../../src/isdn/include;../../../wanpipe/include"
|
||||
AdditionalIncludeDirectories="../../../src/include;../../../src/isdn/include;C:\wanpipe\include"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
|
@ -64,7 +64,7 @@
|
|||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="openzap.lib libsangoma.lib"
|
||||
LinkIncremental="2"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";../../../wanpipe/api/lib/x86"
|
||||
AdditionalLibraryDirectories=""$(OutDir)";C:\wanpipe\lib"
|
||||
GenerateDebugInformation="true"
|
||||
SubSystem="1"
|
||||
RandomizedBaseAddress="1"
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
#include <stdio.h>
|
||||
|
||||
|
||||
void zap_dso_destroy(zap_dso_lib_t *lib) {
|
||||
OZ_DECLARE(void) zap_dso_destroy(zap_dso_lib_t *lib) {
|
||||
if (lib && *lib) {
|
||||
FreeLibrary(*lib);
|
||||
*lib = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
zap_dso_lib_t zap_dso_open(const char *path, char **err) {
|
||||
OZ_DECLARE(zap_dso_lib_t) zap_dso_open(const char *path, char **err) {
|
||||
HINSTANCE lib;
|
||||
|
||||
lib = LoadLibraryEx(path, NULL, 0);
|
||||
|
@ -53,7 +53,7 @@ zap_dso_lib_t zap_dso_open(const char *path, char **err) {
|
|||
return lib;
|
||||
}
|
||||
|
||||
void* zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err) {
|
||||
OZ_DECLARE(void*) zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err) {
|
||||
FARPROC func = GetProcAddress(lib, sym);
|
||||
if (!func) {
|
||||
DWORD error = GetLastError();
|
||||
|
@ -78,14 +78,14 @@ void* zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err) {
|
|||
|
||||
#include <dlfcn.h>
|
||||
|
||||
void zap_dso_destroy(zap_dso_lib_t *lib) {
|
||||
OZ_DECLARE(void) zap_dso_destroy(zap_dso_lib_t *lib) {
|
||||
if (lib && *lib) {
|
||||
dlclose(*lib);
|
||||
*lib = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
zap_dso_lib_t zap_dso_open(const char *path, char **err) {
|
||||
OZ_DECLARE(zap_dso_lib_t) zap_dso_open(const char *path, char **err) {
|
||||
void *lib = dlopen(path, RTLD_NOW | RTLD_LOCAL);
|
||||
if (lib == NULL) {
|
||||
*err = zap_strdup(dlerror());
|
||||
|
@ -93,7 +93,7 @@ zap_dso_lib_t zap_dso_open(const char *path, char **err) {
|
|||
return lib;
|
||||
}
|
||||
|
||||
void *zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err) {
|
||||
OZ_DECLARE(void*) zap_dso_func_sym(zap_dso_lib_t lib, const char *sym, char **err) {
|
||||
void *func = dlsym(lib, sym);
|
||||
if (!func) {
|
||||
*err = zap_strdup(dlerror());
|
||||
|
|
|
@ -34,8 +34,13 @@
|
|||
|
||||
#include "openzap.h"
|
||||
|
||||
#undef zap_queue_t
|
||||
typedef struct zap_queue {
|
||||
static zap_status_t zap_std_queue_create(zap_queue_t **outqueue, zap_size_t capacity);
|
||||
static zap_status_t zap_std_queue_enqueue(zap_queue_t *queue, void *obj);
|
||||
static void *zap_std_queue_dequeue(zap_queue_t *queue);
|
||||
static zap_status_t zap_std_queue_wait(zap_queue_t *queue, int ms);
|
||||
static zap_status_t zap_std_queue_destroy(zap_queue_t **inqueue);
|
||||
|
||||
struct zap_queue {
|
||||
zap_mutex_t *mutex;
|
||||
zap_condition_t *condition;
|
||||
zap_size_t capacity;
|
||||
|
@ -43,21 +48,15 @@ typedef struct zap_queue {
|
|||
unsigned rindex;
|
||||
unsigned windex;
|
||||
void **elements;
|
||||
} zap_queue_t;
|
||||
|
||||
static zap_status_t zap_std_queue_create(zap_queue_t **outqueue, zap_size_t capacity);
|
||||
static zap_status_t zap_std_queue_enqueue(zap_queue_t *queue, void *obj);
|
||||
static void *zap_std_queue_dequeue(zap_queue_t *queue);
|
||||
static zap_status_t zap_std_queue_wait(zap_queue_t *queue, int ms);
|
||||
static zap_status_t zap_std_queue_destroy(zap_queue_t **inqueue);
|
||||
};
|
||||
|
||||
OZ_DECLARE_DATA zap_queue_handler_t g_zap_queue_handler =
|
||||
{
|
||||
.create = zap_std_queue_create,
|
||||
.enqueue = zap_std_queue_enqueue,
|
||||
.dequeue = zap_std_queue_dequeue,
|
||||
.wait = zap_std_queue_wait,
|
||||
.destroy = zap_std_queue_destroy
|
||||
/*.create = */ zap_std_queue_create,
|
||||
/*.enqueue = */ zap_std_queue_enqueue,
|
||||
/*.dequeue = */ zap_std_queue_dequeue,
|
||||
/*.wait = */ zap_std_queue_wait,
|
||||
/*.destroy = */ zap_std_queue_destroy
|
||||
};
|
||||
|
||||
OZ_DECLARE(zap_status_t) zap_global_set_queue_handler(zap_queue_handler_t *handler)
|
||||
|
@ -76,11 +75,12 @@ OZ_DECLARE(zap_status_t) zap_global_set_queue_handler(zap_queue_handler_t *handl
|
|||
|
||||
static zap_status_t zap_std_queue_create(zap_queue_t **outqueue, zap_size_t capacity)
|
||||
{
|
||||
zap_queue_t *queue = NULL;
|
||||
zap_assert_return(outqueue, ZAP_FAIL, "Queue double pointer is null\n");
|
||||
zap_assert_return(capacity > 0, ZAP_FAIL, "Queue capacity is not bigger than 0\n");
|
||||
|
||||
*outqueue = NULL;
|
||||
zap_queue_t *queue = zap_calloc(1, sizeof(*queue));
|
||||
queue = zap_calloc(1, sizeof(*queue));
|
||||
if (!queue) {
|
||||
return ZAP_FAIL;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue