Changeset: eb972da5db0e for MonetDB URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=eb972da5db0e Modified Files: gdk/shared_memory.c gdk/shared_memory.h monetdb5/extras/pyapi/connection.c monetdb5/extras/pyapi/pyapi.c Branch: pyapi Log Message:
Fixes for Windows compilation. diffs (146 lines): diff --git a/gdk/shared_memory.c b/gdk/shared_memory.c --- a/gdk/shared_memory.c +++ b/gdk/shared_memory.c @@ -424,55 +424,4 @@ str release_process_semaphore(int sem_id return MAL_SUCCEED; } -#else -//Windows -> Not yet implemented -#include <stdio.h> -#include <stdlib.h> - -#ifndef false -#define false 0 #endif - -#ifndef true -#define true 1 -#endif - -#define NOTIMPLEMENTED() { \ - printf("FATAL ERROR: Shared memory isn't implemented on Windows yet.\n"); \ - fflush(stdout); \ -} - -str initialize_shared_memory(void) -{ - NOTIMPLEMENTED(); - return NULL; -} - -str create_shared_memory(int id, size_t size, void **return_ptr) -{ - (void) id; (void) size; (void) return_ptr; - NOTIMPLEMENTED(); - return NULL; -} - -str release_shared_memory(void *ptr) -{ - (void) ptr; - NOTIMPLEMENTED(); - return NULL; -} - -int get_unique_shared_memory_id(int offset) -{ - (void) offset; - NOTIMPLEMENTED(); - return -1; -} - -str get_shared_memory(int id, size_t size, void **return_ptr) -{ - (void) id; (void) size; (void) return_ptr; - NOTIMPLEMENTED(); - return NULL; -} -#endif diff --git a/gdk/shared_memory.h b/gdk/shared_memory.h --- a/gdk/shared_memory.h +++ b/gdk/shared_memory.h @@ -13,7 +13,8 @@ #ifndef _SHAREDMEMORY_LIB_ #define _SHAREDMEMORY_LIB_ - + +#ifndef _WIN32 #include "monetdb_config.h" #include "gdk.h" @@ -40,5 +41,6 @@ str get_semaphore_value(int sem_id, int str change_semaphore_value(int sem_id, int number, int change); str change_semaphore_value_timeout(int sem_id, int number, int change, int timeout_mseconds, bool *succeed); str release_process_semaphore(int sem_id); +#endif #endif /* _SHAREDMEMORY_LIB_ */ diff --git a/monetdb5/extras/pyapi/connection.c b/monetdb5/extras/pyapi/connection.c --- a/monetdb5/extras/pyapi/connection.c +++ b/monetdb5/extras/pyapi/connection.c @@ -65,7 +65,9 @@ static PyObject * Py_RETURN_NONE; } } - else { + else +#ifndef WIN32 + { // This is a mapped process, we do not want forked processes to touch the database // Only the main process may touch the database, so we ship the query back to the main process // copy the query into shared memory and tell the main process there is a query to handle @@ -152,6 +154,12 @@ static PyObject * Py_RETURN_NONE; } +#else + { + PyErr_Format(PyExc_Exception, "Mapped is not supported on Windows."); + return NULL; + } +#endif } static PyMethodDef _connectionObject_methods[] = { diff --git a/monetdb5/extras/pyapi/pyapi.c b/monetdb5/extras/pyapi/pyapi.c --- a/monetdb5/extras/pyapi/pyapi.c +++ b/monetdb5/extras/pyapi/pyapi.c @@ -387,9 +387,9 @@ str PyAPIeval(Client cntxt, MalBlkPtr mb PyReturn *pyreturn_values = NULL; PyInput *pyinput_values = NULL; int seqbase = 0; +#ifndef WIN32 char *shm_ptr; QueryStruct *query_ptr = NULL; -#ifndef WIN32 int query_sem = -1; int shm_id = -1; size_t memory_size = 0; @@ -1257,6 +1257,7 @@ wrapup: if (ret->numpy_array != NULL) Py_DECREF(ret->numpy_array); if (ret->numpy_mask != NULL) Py_DECREF(ret->numpy_mask); } +#ifndef WIN32 // If there is no numpy array, but there is array data, then that array data must be shared memory if (ret->numpy_array == NULL && ret->array_data != NULL) { release_shared_memory(ret->array_data); @@ -1264,6 +1265,7 @@ wrapup: if (ret->numpy_mask == NULL && ret->mask_data != NULL) { release_shared_memory(ret->mask_data); } +#endif } if (pResult != NULL) { Py_DECREF(pResult); @@ -1325,7 +1327,9 @@ str PyRun_SimpleString("import numpy"); PyByteArray_Override(); import_array1(iar); +#ifndef WIN32 initialize_shared_memory(); +#endif lazyarray_init(); _connection_init(); marshal_module = PyImport_Import(PyString_FromString("marshal")); _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list