[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[SCM] GNU gnutls branch, master, updated. gnutls_2_99_1-36-gf90470a
From: |
Nikos Mavrogiannopoulos |
Subject: |
[SCM] GNU gnutls branch, master, updated. gnutls_2_99_1-36-gf90470a |
Date: |
Tue, 17 May 2011 20:55:01 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU gnutls".
http://git.savannah.gnu.org/cgit/gnutls.git/commit/?id=f90470a7b4c672a916c4513cecf4b9a6bce0eb67
The branch, master has been updated
via f90470a7b4c672a916c4513cecf4b9a6bce0eb67 (commit)
from 25f4ccce42d43f424d6418c7f1ad2a231e464a1b (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit f90470a7b4c672a916c4513cecf4b9a6bce0eb67
Author: Nikos Mavrogiannopoulos <address@hidden>
Date: Tue May 17 22:54:58 2011 +0200
more win32 fixes.
-----------------------------------------------------------------------
Summary of changes:
src/benchmark-common.c | 78 +++++++++++++++++++++---------------------------
src/benchmark.h | 4 ++-
2 files changed, 37 insertions(+), 45 deletions(-)
diff --git a/src/benchmark-common.c b/src/benchmark-common.c
index b6b426a..0e47879 100644
--- a/src/benchmark-common.c
+++ b/src/benchmark-common.c
@@ -8,13 +8,7 @@
int benchmark_must_finish = 0;
-#if !defined(_WIN32)
-static void
-alarm_handler (int signo)
-{
- benchmark_must_finish = 1;
-}
-#else
+#if defined(_WIN32)
#include <windows.h>
DWORD WINAPI
alarm_handler (LPVOID lpParameter)
@@ -24,34 +18,12 @@ alarm_handler (LPVOID lpParameter)
benchmark_must_finish = 1;
return 0;
}
-
-#define W32_ALARM_VARIABLES HANDLE wtimer = NULL, wthread = NULL; \
- LARGE_INTEGER alarm_timeout = { 0 , 0 }
-#define W32_ALARM_TRIGGER(timeout, leave) { \
- st->wtimer = CreateWaitableTimer (NULL, TRUE, NULL); \
- if (st->wtimer == NULL) \
- { \
- fprintf (stderr, "error: CreateWaitableTimer %u\n", GetLastError ()); \
- leave; \
- } \
- st->wthread = CreateThread (NULL, 0, alarm_handler, &st->wtimer, 0, NULL); \
- if (st->wthread == NULL) \
- { \
- fprintf (stderr, "error: CreateThread %u\n", GetLastError ()); \
- leave; \
- } \
- alarm_timeout.QuadPart = timeout * 10000000; \
- if (SetWaitableTimer (st->wtimer, &alarm_timeout, 0, NULL, NULL, FALSE) ==
0) \
- { \
- fprintf (stderr, "error: SetWaitableTimer %u\n", GetLastError ()); \
- leave; \
- } \
- }
-#define W32_ALARM_CLEANUP { \
- if (st->wtimer != NULL) \
- CloseHandle (st->wtimer); \
- if (st->wthread != NULL) \
- CloseHandle (st->wthread);}
+#else
+static void
+alarm_handler (int signo)
+{
+ benchmark_must_finish = 1;
+}
#endif
static void
@@ -90,17 +62,33 @@ value2human (unsigned long bytes, double time, double
*data, double *speed,
void start_benchmark(struct benchmark_st * st)
{
+ memset(st, 0, sizeof(st));
st->old_handler = signal (SIGALRM, alarm_handler);
+ gettime (&st->start);
- benchmark_must_finish = 0;
- st->size = 0;
-
-#if !defined(_WIN32)
- alarm (5);
+#if defined(_WIN32)
+ st->wtimer = CreateWaitableTimer (NULL, TRUE, NULL);
+ if (st->wtimer == NULL)
+ {
+ fprintf (stderr, "error: CreateWaitableTimer %u\n", GetLastError ());
+ exit(1);
+ }
+ st->wthread = CreateThread (NULL, 0, alarm_handler, &st->wtimer, 0, NULL);
+ if (st->wthread == NULL)
+ {
+ fprintf (stderr, "error: CreateThread %u\n", GetLastError ());
+ exit(1);
+ }
+ alarm_timeout.QuadPart = (5) * 10000000;
+ if (SetWaitableTimer (st->wtimer, &alarm_timeout, 0, NULL, NULL, FALSE) == 0)
+ {
+ fprintf (stderr, "error: SetWaitableTimer %u\n", GetLastError ());
+ exit(1);
+ }
+ }
#else
- W32_ALARM_TRIGGER(5, goto leave);
+ alarm (5);
#endif
- gettime (&st->start);
}
@@ -113,8 +101,10 @@ double stop_benchmark(struct benchmark_st * st)
char metric[16];
#if defined(_WIN32)
-leave:
- W32_ALARM_CLEANUP;
+ if (st->wtimer != NULL)
+ CloseHandle (st->wtimer);
+ if (st->wthread != NULL)
+ CloseHandle (st->wthread);
#else
signal(SIGALRM, st->old_handler);
#endif
diff --git a/src/benchmark.h b/src/benchmark.h
index 0627e01..826ed20 100644
--- a/src/benchmark.h
+++ b/src/benchmark.h
@@ -11,7 +11,9 @@ struct benchmark_st
unsigned long size;
sighandler_t old_handler;
#if defined(_WIN32)
- W32_ALARM_VARIABLES;
+ HANDLE wtimer;
+ HANDLE wthread;
+ LARGE_INTEGER alarm_timeout;
#endif
};
hooks/post-receive
--
GNU gnutls
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [SCM] GNU gnutls branch, master, updated. gnutls_2_99_1-36-gf90470a,
Nikos Mavrogiannopoulos <=