Changeset: 72af72ddf19a for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=72af72ddf19a
Modified Files:
MonetDB/NT/MonetDB-Common/MonetDB-Common.vdproj
MonetDB/NT/MonetDB-Common/MonetDB-Common64.vdproj
pathfinder/NT/MonetDB4-XQuery/MonetDB4-XQuery-Installer.vdproj
pathfinder/NT/MonetDB4-XQuery64/MonetDB4-XQuery-Installer.vdproj
sql/NT/MonetDB5-SQL/MonetDB5-SQL-Installer.vdproj
sql/NT/MonetDB5-SQL64/MonetDB5-SQL-Installer.vdproj
Branch: default
Log Message:
Merge with Oct2010 branch.
diffs (truncated from 1191 to 300 lines):
diff -r 338278a768f4 -r 72af72ddf19a
MonetDB/NT/MonetDB-Common/MonetDB-Common.vdproj
--- a/MonetDB/NT/MonetDB-Common/MonetDB-Common.vdproj Tue Nov 02 12:41:42
2010 +0100
+++ b/MonetDB/NT/MonetDB-Common/MonetDB-Common.vdproj Tue Nov 02 13:08:56
2010 +0100
@@ -51,12 +51,6 @@
}
"Entry"
{
- "MsmKey" = "8:_BB4791ABAA4349E4A0DE1EDA0772E622"
- "OwnerKey" = "8:_UNDEFINED"
- "MsmSig" = "8:_UNDEFINED"
- }
- "Entry"
- {
"MsmKey" = "8:_BFB12BC46509499A943E79B9BECB1E9A"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
@@ -305,26 +299,6 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_BB4791ABAA4349E4A0DE1EDA0772E622"
- {
- "SourcePath" = "8:C:\\Libraries\\Pthreads\\lib\\pthreadVC2.dll"
- "TargetName" = "8:pthreadVC2.dll"
- "Tag" = "8:"
- "Folder" = "8:_AC71646495814C55B03F69019B5070C2"
- "Condition" = "8:"
- "Transitive" = "11:FALSE"
- "Vital" = "11:TRUE"
- "ReadOnly" = "11:FALSE"
- "Hidden" = "11:FALSE"
- "System" = "11:FALSE"
- "Permanent" = "11:FALSE"
- "SharedLegacy" = "11:FALSE"
- "PackageAs" = "3:1"
- "Register" = "3:1"
- "Exclude" = "11:FALSE"
- "IsDependency" = "11:FALSE"
- "IsolateTo" = "8:"
- }
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_BFB12BC46509499A943E79B9BECB1E9A"
{
"SourcePath" = "8:C:\\Program Files\\PCRE\\bin\\pcre.dll"
diff -r 338278a768f4 -r 72af72ddf19a
MonetDB/NT/MonetDB-Common/MonetDB-Common64.vdproj
--- a/MonetDB/NT/MonetDB-Common/MonetDB-Common64.vdproj Tue Nov 02 12:41:42
2010 +0100
+++ b/MonetDB/NT/MonetDB-Common/MonetDB-Common64.vdproj Tue Nov 02 13:08:56
2010 +0100
@@ -51,12 +51,6 @@
}
"Entry"
{
- "MsmKey" = "8:_BB4791ABAA4349E4A0DE1EDA0772E622"
- "OwnerKey" = "8:_UNDEFINED"
- "MsmSig" = "8:_UNDEFINED"
- }
- "Entry"
- {
"MsmKey" = "8:_BFB12BC46509499A943E79B9BECB1E9A"
"OwnerKey" = "8:_UNDEFINED"
"MsmSig" = "8:_UNDEFINED"
@@ -285,26 +279,6 @@
"IsDependency" = "11:FALSE"
"IsolateTo" = "8:"
}
-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_BB4791ABAA4349E4A0DE1EDA0772E622"
- {
- "SourcePath" = "8:C:\\Libraries\\Pthreads\\lib64\\pthreadVC2.dll"
- "TargetName" = "8:pthreadVC2.dll"
- "Tag" = "8:"
- "Folder" = "8:_AC71646495814C55B03F69019B5070C2"
- "Condition" = "8:"
- "Transitive" = "11:FALSE"
- "Vital" = "11:TRUE"
- "ReadOnly" = "11:FALSE"
- "Hidden" = "11:FALSE"
- "System" = "11:FALSE"
- "Permanent" = "11:FALSE"
- "SharedLegacy" = "11:FALSE"
- "PackageAs" = "3:1"
- "Register" = "3:1"
- "Exclude" = "11:FALSE"
- "IsDependency" = "11:FALSE"
- "IsolateTo" = "8:"
- }
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_BFB12BC46509499A943E79B9BECB1E9A"
{
"SourcePath" = "8:C:\\Program Files\\PCRE\\bin\\pcre.dll"
diff -r 338278a768f4 -r 72af72ddf19a MonetDB/src/gdk/gdk_system.mx
--- a/MonetDB/src/gdk/gdk_system.mx Tue Nov 02 12:41:42 2010 +0100
+++ b/MonetDB/src/gdk/gdk_system.mx Tue Nov 02 13:08:56 2010 +0100
@@ -179,6 +179,16 @@
@- MT Lock API
@h
+#if !defined(HAVE_PTHREAD_H) && defined(_MSC_VER)
+typedef HANDLE pthread_mutex_t;
+typedef void *pthread_mutexattr_t;
+gdk_export void pthread_mutex_init(pthread_mutex_t *, const
pthread_mutexattr_t *);
+gdk_export void pthread_mutex_destroy(pthread_mutex_t *);
+gdk_export int pthread_mutex_lock(pthread_mutex_t *);
+gdk_export int pthread_mutex_trylock(pthread_mutex_t *);
+gdk_export int pthread_mutex_unlock(pthread_mutex_t *);
+#endif
+
typedef pthread_mutex_t MT_Lock;
#define MT_lock_init(l,n) { pthread_mutex_init((pthread_mutex_t*) l, 0);
MT_locktrace_set(l,n); }
@@ -200,7 +210,13 @@
@- MT Semaphore API
@h
-#if defined(_AIX) || defined(__MACH__)
+#if !defined(HAVE_PTHREAD_H) && defined(_MSC_VER)
+typedef HANDLE pthread_sema_t;
+gdk_export void pthread_sema_init(pthread_sema_t *s, int flag, int nresources);
+gdk_export void pthread_sema_destroy(pthread_sema_t *s);
+gdk_export void pthread_sema_up(pthread_sema_t *s);
+gdk_export void pthread_sema_down(pthread_sema_t *s);
+#elif defined(_AIX) || defined(__MACH__)
typedef struct {
int cnt;
pthread_mutex_t mutex;
@@ -236,6 +252,18 @@
@- MT Conditional Variable API
@h
+#if !defined(HAVE_PTHREAD_H) && defined(_MSC_VER)
+typedef struct {
+ int waiters_count; /* number of waiting threads */
+ CRITICAL_SECTION waiters_count_lock; /* serialize access to
waiters_count_ */
+ HANDLE sema; /* queue up threads waiting for condition */
+} pthread_cond_t;
+typedef void *pthread_condattr_t;
+gdk_export int pthread_cond_init(pthread_cond_t *, pthread_condattr_t *);
+gdk_export int pthread_cond_destroy(pthread_cond_t *);
+gdk_export int pthread_cond_signal(pthread_cond_t *);
+gdk_export int pthread_cond_wait(pthread_cond_t *, pthread_mutex_t *);
+#endif
typedef pthread_cond_t MT_Cond;
#define MT_cond_init(c,n) { pthread_cond_init((pthread_cond_t*) c, NULL);
MT_locktrace_set(c,n); }
@@ -262,7 +290,11 @@
size_t _MT_pagesize = 0; /* variable holding memory size */
size_t _MT_npages = 0; /* variable holding page size */
-MT_Lock MT_system_lock = PTHREAD_MUTEX_INITIALIZER;
+MT_Lock MT_system_lock
+#ifdef PTHREAD_MUTEX_INITIALIZER
+ = PTHREAD_MUTEX_INITIALIZER
+#endif
+ ;
#ifdef MT_LOCK_TRACE
unsigned long long MT_locktrace_cnt[65536] = { 0 };
@@ -410,6 +442,249 @@
#endif
}
+#if !defined(HAVE_PTHREAD_H) && defined(_MSC_VER)
+static struct winthread {
+ struct winthread *next;
+ HANDLE hdl;
+ DWORD tid;
+ void (*func) (void *);
+ void *arg;
+} *winthreads = NULL;
+static CRITICAL_SECTION winthread_cs;
+static int winthread_cs_init = 0;
+
+static void
+rm_winthread(struct winthread *w)
+{
+ struct winthread **wp;
+
+ assert(winthread_cs_init);
+ EnterCriticalSection(&winthread_cs);
+ for (wp = &winthreads; *wp && *wp != w; wp = &(*wp)->next)
+ ;
+ if (*wp)
+ *wp = w->next;
+ LeaveCriticalSection(&winthread_cs);
+ GDKfree(w);
+}
+
+static DWORD WINAPI
+thread_starter(LPVOID arg)
+{
+ (*((struct winthread *) arg)->func)(((struct winthread *) arg)->arg);
+ if (((struct winthread *) arg)->hdl == NULL)
+ rm_winthread((struct winthread *) arg);
+ ExitThread(0);
+ return TRUE;
+}
+
+int
+MT_create_thread(MT_Id *t, void (*f) (void *), void *arg, enum MT_thr_detach d)
+{
+ struct winthread *w = GDKmalloc(sizeof(*w));
+
+ if (winthread_cs_init == 0) {
+ /* we only get here before any threads are created,
+ and this is the only time that winthread_cs_init is
+ ever changed */
+ InitializeCriticalSection(&winthread_cs);
+ winthread_cs_init = 1;
+ }
+ w->func = f;
+ w->arg = arg;
+ EnterCriticalSection(&winthread_cs);
+ w->next = winthreads;
+ winthreads = w;
+ LeaveCriticalSection(&winthread_cs);
+ w->hdl = CreateThread(NULL, THREAD_STACK_SIZE, thread_starter, w, 0,
&w->tid);
+ if (w->hdl == NULL) {
+ rm_winthread(w);
+ return -1;
+ }
+ *t = (MT_Id) w->tid;
+ if (d == MT_THR_DETACHED) {
+ /* not joinable */
+ CloseHandle(w->hdl);
+ w->hdl = NULL;
+ }
+ return 0;
+}
+
+void
+MT_exit_thread(int s)
+{
+ DWORD t;
+ struct winthread *w;
+
+ assert(winthread_cs_init);
+ t = GetCurrentThreadId();
+ EnterCriticalSection(&winthread_cs);
+ for (w = winthreads; w && w->tid != t; w = w->next)
+ ;
+ LeaveCriticalSection(&winthread_cs);
+ if (w->hdl == NULL)
+ rm_winthread(w);
+ ExitThread(s);
+}
+
+int
+MT_join_thread(MT_Id t)
+{
+ struct winthread *w;
+
+ assert(winthread_cs_init);
+ EnterCriticalSection(&winthread_cs);
+ for (w = winthreads; w && w->tid != t; w = w->next)
+ ;
+ LeaveCriticalSection(&winthread_cs);
+ if (w == NULL || w->hdl == NULL)
+ return -1;
+ if (WaitForSingleObject(w->hdl, INFINITE) == WAIT_OBJECT_0 &&
+ CloseHandle(w->hdl)) {
+ rm_winthread(w);
+ return 0;
+ }
+ return -1;
+}
+
+int
+MT_kill_thread(MT_Id t)
+{
+ struct winthread *w;
+
+ assert(winthread_cs_init);
+ EnterCriticalSection(&winthread_cs);
+ for (w = winthreads; w && w->tid != t; w = w->next)
+ ;
+ LeaveCriticalSection(&winthread_cs);
+ if (w == NULL)
+ return -1;
+ if (w->hdl == NULL) {
+ /* detached thread */
+ HANDLE h;
+ int ret = 0;
+ h = OpenThread(THREAD_ALL_ACCESS, 0, (DWORD) t);
+ if (h == NULL)
+ return -1;
+ if (TerminateThread(h, -1))
+ ret = -1;
+ CloseHandle(h);
+ return ret;
+ }
+ if (TerminateThread(w->hdl, -1))
+ return 0;
+ return -1;
+}
+
+void
+pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t
*mutexattr)
+{
+ (void) mutexattr;
+ *mutex = CreateMutex(NULL, 0, NULL);
+}
+
+void
+pthread_mutex_destroy(pthread_mutex_t *mutex)
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list