Changeset: 9b9d1f1578b1 for MonetDB URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=9b9d1f1578b1 Added Files: common/utils/matomic.h sql/jdbc/tests/Tests/Test_CallableStmt.SQL.bat sql/jdbc/tests/Tests/Test_CallableStmt.SQL.sh sql/jdbc/tests/Tests/Test_CallableStmt.stable.err sql/jdbc/tests/Tests/Test_CallableStmt.stable.out Removed Files: gdk/gdk_atomic.h Modified Files: MonetDB.spec NT/mksqlwxs.py clients/Tests/exports.stable.out clients/mapiclient/ReadlineTools.c clients/mapiclient/ReadlineTools.h clients/mapiclient/dump.c clients/mapiclient/mnc.c clients/mapiclient/stethoscope.c clients/mapiclient/tachograph.c clients/mapiclient/tomograph.c clients/mapilib/Makefile.ag clients/mapilib/mapi.c clients/odbc/driver/Makefile.ag clients/odbc/driver/SQLConnect.c common/stream/Makefile.ag common/stream/stream.c common/utils/Makefile.ag configure.ag debian/libmonetdb-dev.install gdk/Makefile.ag gdk/gdk_posix.c gdk/gdk_system.h gdk/gdk_utils.c gdk/gdk_utils.h geom/lib/Makefile.ag geom/monetdb5/Makefile.ag monetdb5/extras/mal_optimizer_template/Makefile.ag monetdb5/extras/rapi/Makefile.ag monetdb5/mal/Makefile.ag monetdb5/mal/mal_interpreter.c monetdb5/mal/mal_resource.h monetdb5/modules/atoms/Makefile.ag monetdb5/modules/kernel/Makefile.ag monetdb5/modules/mal/Makefile.ag monetdb5/modules/mal/remote.c monetdb5/modules/mal/remote.h monetdb5/optimizer/Makefile.ag monetdb5/optimizer/opt_commonTerms.c monetdb5/scheduler/Makefile.ag sql/backends/monet5/Makefile.ag sql/backends/monet5/UDF/capi/Makefile.ag sql/backends/monet5/UDF/pyapi/Makefile.ag sql/backends/monet5/UDF/pyapi/pyapi.c sql/backends/monet5/UDF/pyapi/pyapi.h sql/backends/monet5/UDF/pyapi3/Makefile.ag sql/backends/monet5/UDF/udf/Makefile.ag sql/backends/monet5/generator/Makefile.ag sql/backends/monet5/vaults/bam/Makefile.ag sql/backends/monet5/vaults/fits/Makefile.ag sql/backends/monet5/vaults/lidar/Makefile.ag sql/backends/monet5/vaults/netcdf/Makefile.ag sql/backends/monet5/vaults/shp/Makefile.ag sql/common/Makefile.ag sql/jdbc/tests/Tests/All sql/server/Makefile.ag sql/storage/Makefile.ag sql/storage/bat/Makefile.ag tools/merovingian/daemon/controlrunner.c tools/merovingian/utils/Makefile.ag Branch: subquery Log Message:
merged with default diffs (truncated from 1550 to 300 lines): diff --git a/MonetDB.spec b/MonetDB.spec --- a/MonetDB.spec +++ b/MonetDB.spec @@ -221,6 +221,7 @@ functionality of MonetDB. %defattr(-,root,root) %dir %{_includedir}/monetdb %{_includedir}/monetdb/gdk*.h +%{_includedir}/monetdb/matomic.h %{_includedir}/monetdb/monet*.h %{_libdir}/libbat.so %{_libdir}/pkgconfig/monetdb-gdk.pc diff --git a/NT/mksqlwxs.py b/NT/mksqlwxs.py --- a/NT/mksqlwxs.py +++ b/NT/mksqlwxs.py @@ -170,6 +170,7 @@ def main(): id = comp(extend, id, 16, sorted([r'include\monetdb\%s' % x for x in filter(lambda x: (x.startswith('gdk') or x.startswith('monet') or x.startswith('mal')) and x.endswith('.h'), os.listdir(os.path.join(sys.argv[3], 'include', 'monetdb')))] + [r'include\monetdb\mapi.h', + r'include\monetdb\matomic.h', r'include\monetdb\stream.h', r'include\monetdb\stream_socket.h']), vital = 'no') diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out --- a/clients/Tests/exports.stable.out +++ b/clients/Tests/exports.stable.out @@ -251,7 +251,7 @@ bool GDKgetenv_istrue(const char *name); bool GDKgetenv_isyes(const char *name); gdk_return GDKgetsem(int sem_id, int count, int *semid); gdk_return GDKgetsemval(int sem_id, int number, int *semval); -gdk_return GDKinit(opt *set, int setlen); +gdk_return GDKinit(struct opt *set, int setlen); void *GDKinitmmap(size_t id, size_t size, size_t *return_size); ATOMIC_TYPE GDKlockcnt; ATOMIC_TYPE GDKlockcontentioncnt; @@ -1721,7 +1721,6 @@ str RMTisalive(int *ret, str *conn); str RMTprelude(void *ret); str RMTput(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); str RMTregister(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci); -str RMTregisterInternal(Client cntxt, str conn, str mod, str fcn); str RMTregisterSupervisor(int *ret, str *sup_uuid, str *query_uuid); str RMTresolve(bat *ret, str *pat); str RUNadder(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr p); diff --git a/clients/mapiclient/ReadlineTools.c b/clients/mapiclient/ReadlineTools.c --- a/clients/mapiclient/ReadlineTools.c +++ b/clients/mapiclient/ReadlineTools.c @@ -10,7 +10,6 @@ * Readline specific stuff */ #include "monetdb_config.h" -#include "monet_options.h" #ifdef HAVE_LIBREADLINE @@ -41,7 +40,7 @@ static const char *sql_commands[] = { static Mapi _mid; static char _history_file[FILENAME_MAX]; static int _save_history = 0; -static char *language; +static const char *language; static char * sql_tablename_generator(const char *text, int state) @@ -302,7 +301,7 @@ continue_completion(rl_completion_func_t } void -init_readline(Mapi mid, char *lang, int save_history) +init_readline(Mapi mid, const char *lang, int save_history) { language = lang; _mid = mid; @@ -322,7 +321,6 @@ init_readline(Mapi mid, char *lang, int if (save_history) { int len; -#ifndef NATIVE_WIN32 if (getenv("HOME") != NULL) { len = snprintf(_history_file, FILENAME_MAX, "%s/.mapiclient_history_%s", @@ -332,15 +330,6 @@ init_readline(Mapi mid, char *lang, int else _save_history = 1; } -#else - len = snprintf(_history_file, FILENAME_MAX, - "%s%c_mapiclient_history_%s", - mo_find_option(NULL, 0, "prefix"), DIR_SEP, language); - if (len == -1 || len >= FILENAME_MAX) - fprintf(stderr, "Warning: history filename path is too large\n"); - else - _save_history = 1; -#endif if (_save_history) { FILE *f; switch (read_history(_history_file)) { diff --git a/clients/mapiclient/ReadlineTools.h b/clients/mapiclient/ReadlineTools.h --- a/clients/mapiclient/ReadlineTools.h +++ b/clients/mapiclient/ReadlineTools.h @@ -13,7 +13,7 @@ #include "mapi.h" -void init_readline(Mapi mid, char *language, int save_history); +void init_readline(Mapi mid, const char *language, int save_history); void deinit_readline(void); void save_line(const char *s); rl_completion_func_t *suspend_completion(void); diff --git a/clients/mapiclient/dump.c b/clients/mapiclient/dump.c --- a/clients/mapiclient/dump.c +++ b/clients/mapiclient/dump.c @@ -7,7 +7,6 @@ */ #include "monetdb_config.h" -#include "monet_options.h" #include "mapi.h" #include "stream.h" #include <unistd.h> diff --git a/clients/mapiclient/mnc.c b/clients/mapiclient/mnc.c --- a/clients/mapiclient/mnc.c +++ b/clients/mapiclient/mnc.c @@ -16,7 +16,6 @@ */ #include "monetdb_config.h" -#include "monet_options.h" #include "mapi.h" #include "stream.h" #include "stream_socket.h" diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c --- a/clients/mapiclient/stethoscope.c +++ b/clients/mapiclient/stethoscope.c @@ -17,7 +17,6 @@ */ #include "monetdb_config.h" -#include "monet_options.h" #include "stream.h" #include "stream_socket.h" #include "mapi.h" diff --git a/clients/mapiclient/tachograph.c b/clients/mapiclient/tachograph.c --- a/clients/mapiclient/tachograph.c +++ b/clients/mapiclient/tachograph.c @@ -13,7 +13,6 @@ */ #include "monetdb_config.h" -#include "monet_options.h" #include "stream.h" #include "stream_socket.h" #include "mapi.h" diff --git a/clients/mapiclient/tomograph.c b/clients/mapiclient/tomograph.c --- a/clients/mapiclient/tomograph.c +++ b/clients/mapiclient/tomograph.c @@ -17,7 +17,6 @@ */ #include "monetdb_config.h" -#include "monet_options.h" #include "stream.h" #include "stream_socket.h" #include "mapi.h" diff --git a/clients/mapilib/Makefile.ag b/clients/mapilib/Makefile.ag --- a/clients/mapilib/Makefile.ag +++ b/clients/mapilib/Makefile.ag @@ -6,7 +6,7 @@ MTSAFE -INCLUDES = ../../common/options ../../common/stream ../../common/utils \ +INCLUDES = ../../common/stream ../../common/utils \ $(MSGCONTROL_FLAGS) $(openssl_CFLAGS) lib_mapi = { diff --git a/clients/mapilib/mapi.c b/clients/mapilib/mapi.c --- a/clients/mapilib/mapi.c +++ b/clients/mapilib/mapi.c @@ -688,6 +688,7 @@ #include "stream_socket.h" #include "mapi.h" #include "mcrypt.h" +#include "matomic.h" #ifdef HAVE_UNISTD_H # include <unistd.h> @@ -952,7 +953,7 @@ static int unquote(const char *msg, char static int mapi_slice_row(struct MapiResultSet *result, int cr); static void mapi_store_bind(struct MapiResultSet *result, int cr); -static bool mapi_initialized = false; +static ATOMIC_FLAG mapi_initialized = ATOMIC_FLAG_INIT; #define check_stream(mid,s,msg,f,e) \ do { \ @@ -1036,7 +1037,7 @@ mapi_error_str(Mapi mid) } #ifdef _MSC_VER -static struct { +static const struct { int e; const char *m; } wsaerrlist[] = { @@ -1796,7 +1797,7 @@ static Mapi mapi_new(void) { Mapi mid; - static uint32_t index = 0; + static ATOMIC_TYPE index = ATOMIC_VAR_INIT(0); mid = malloc(sizeof(*mid)); if (mid == NULL) @@ -1804,7 +1805,7 @@ mapi_new(void) /* then fill in some details */ *mid = (struct MapiStruct) { - .index = index++, /* for distinctions in log records */ + .index = (uint32_t) ATOMIC_ADD(&index, 1), /* for distinctions in log records */ .auto_commit = true, .error = MOK, .languageId = LANG_SQL, @@ -1912,8 +1913,7 @@ mapi_mapiuri(const char *url, const char char *dbname; char *query; - if (!mapi_initialized) { - mapi_initialized = true; + if (!ATOMIC_TAS(&mapi_initialized)) { if (mnstr_init() < 0) return NULL; } @@ -2028,8 +2028,7 @@ mapi_mapi(const char *host, int port, co { Mapi mid; - if (!mapi_initialized) { - mapi_initialized = true; + if (!ATOMIC_TAS(&mapi_initialized)) { if (mnstr_init() < 0) return NULL; } diff --git a/clients/odbc/driver/Makefile.ag b/clients/odbc/driver/Makefile.ag --- a/clients/odbc/driver/Makefile.ag +++ b/clients/odbc/driver/Makefile.ag @@ -6,7 +6,6 @@ INCLUDES = \ ../../mapilib \ - ../../../common/options \ $(ODBC_INCS) DEFS = @DEFS@ diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c --- a/clients/odbc/driver/SQLConnect.c +++ b/clients/odbc/driver/SQLConnect.c @@ -28,7 +28,6 @@ #include "ODBCGlobal.h" #include "ODBCDbc.h" #include "ODBCUtil.h" -#include "monet_options.h" #include <time.h> #ifdef HAVE_ODBCINST_H diff --git a/common/stream/Makefile.ag b/common/stream/Makefile.ag --- a/common/stream/Makefile.ag +++ b/common/stream/Makefile.ag @@ -8,7 +8,8 @@ MTSAFE -INCLUDES = $(zlib_CFLAGS) \ +INCLUDES = ../utils \ + $(zlib_CFLAGS) \ $(bzip2_CFLAGS) \ $(snappy_CFLAGS) \ $(lz4_CFLAGS) \ diff --git a/common/stream/stream.c b/common/stream/stream.c --- a/common/stream/stream.c +++ b/common/stream/stream.c @@ -52,6 +52,7 @@ #include "monetdb_config.h" #include "stream.h" #include "stream_socket.h" +#include "matomic.h" #include <string.h> #include <stddef.h> @@ -211,9 +212,9 @@ struct stream { int mnstr_init(void) { - static bool inited = false; - - if (inited) + static ATOMIC_FLAG inited = ATOMIC_FLAG_INIT; + + if (ATOMIC_TAS(&inited)) return 0; #ifdef NATIVE_WIN32 _______________________________________________ checkin-list mailing list checkin-list@monetdb.org https://www.monetdb.org/mailman/listinfo/checkin-list