Changeset: c2232864f21d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c2232864f21d
Modified Files:
        
Branch: default
Log Message:

Merge with Apr2012 branch.


diffs (70 lines):

diff --git a/clients/NT/Makefile.ag b/clients/NT/Makefile.ag
--- a/clients/NT/Makefile.ag
+++ b/clients/NT/Makefile.ag
@@ -18,5 +18,5 @@
 scripts_bat = {
        EXT = bat
        DIR = prefix
-       SOURCES = mclient.bat msqldump.bat
+       SOURCES = mclient.bat msqldump.bat stethoscope.bat
 }
diff --git a/clients/NT/stethoscope.bat b/clients/NT/stethoscope.bat
new file mode 100755
--- /dev/null
+++ b/clients/NT/stethoscope.bat
@@ -0,0 +1,15 @@
+@echo off
+rem figure out the folder name
+set MONETDB=%~dp0
+
+rem remove the final backslash from the path
+set MONETDB=%MONETDB:~0,-1%
+
+rem extend the search path with our EXE and DLL folders
+rem we depend on pthreadVCE.dll having been copied to the lib folder
+set PATH=%MONETDB%\bin;%MONETDB%\lib;%MONETDB%\lib\bin;%PATH%
+
+rem start the real client
+"%MONETDB%\bin\stethoscope.exe" %1 %2 %3 %4 %5 %6 %7 %8
+
+if ERRORLEVEL 1 pause
diff --git a/clients/mapiclient/stethoscope.c b/clients/mapiclient/stethoscope.c
--- a/clients/mapiclient/stethoscope.c
+++ b/clients/mapiclient/stethoscope.c
@@ -187,8 +187,9 @@ doProfile(void *d)
        wthread *wthr = (wthread*)d;
        int i;
        size_t a;
+       ssize_t n;
        char *response, *x;
-       char buf[BUFSIZ];
+       char buf[BUFSIZ + 1];
        char *e;
        char *mod, *fcn;
        char *host;
@@ -282,7 +283,8 @@ doProfile(void *d)
        fflush(NULL);
 
        i = 0;
-       while (mnstr_read(wthr->s, buf, 1, BUFSIZ)) {
+       while ((n = mnstr_read(wthr->s, buf, 1, BUFSIZ)) > 0) {
+               buf[n] = 0;
                response = buf;
                while ((e = strchr(response, '\n')) != NULL) {
                        *e = 0;
@@ -477,6 +479,7 @@ main(int argc, char **argv)
                 * the function never terminates... at least on Linux */
 #if !defined(HAVE_PTHREAD_H) && defined(_MSC_VER)
                walk->id = CreateThread(NULL, 0, doProfile, walk, 0, NULL);
+               WaitForSingleObject(walk->id, INFINITE);
                CloseHandle(walk->id);
 #else
                pthread_create(&walk->id, NULL, &doProfile, walk);
@@ -510,6 +513,7 @@ main(int argc, char **argv)
                free(oalts);
                for (walk = thds; walk != NULL; walk = walk->next) {
 #if !defined(HAVE_PTHREAD_H) && defined(_MSC_VER)
+                       WaitForSingleObject(walk->id, INFINITE);
                        CloseHandle(walk->id);
 #else
                        pthread_join(walk->id, NULL);
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to