Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
postgres-lambda-diff
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jakob Huber
postgres-lambda-diff
Commits
7ae2db1d
Commit
7ae2db1d
authored
13 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Try to get pg_test_thread to compile on Windows by using a sleeper
thread.
parent
58d74621
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/pg_test_fsync/pg_test_fsync.c
+22
-0
22 additions, 0 deletions
contrib/pg_test_fsync/pg_test_fsync.c
with
22 additions
and
0 deletions
contrib/pg_test_fsync/pg_test_fsync.c
+
22
−
0
View file @
7ae2db1d
...
...
@@ -28,12 +28,26 @@
#define OPS_FORMAT "%9.3f ops/sec"
/* These are macros to avoid timing the function call overhead. */
#ifndef WIN32
#define START_TIMER \
do { \
alarm_triggered = false; \
alarm(secs_per_test); \
gettimeofday(&start_t, NULL); \
} while (0)
#else
#define START_TIMER \
do { \
alarm_triggered = false; \
if (CreateThread(NULL, 0, process_alarm, NULL, 0, NULL) == \
INVALID_HANDLE_VALUE) \
{ \
fprintf(stderr, "Cannot create thread for alarm\n"); \
exit(1); \
} \
gettimeofday(&start_t, NULL); \
} while (0)
#endif
#define STOP_TIMER \
do { \
...
...
@@ -82,7 +96,9 @@ main(int argc, char *argv[])
/* Prevent leaving behind the test file */
signal
(
SIGINT
,
signal_cleanup
);
signal
(
SIGTERM
,
signal_cleanup
);
#ifndef WIN32
signal
(
SIGALRM
,
process_alarm
);
#endif
#ifdef SIGHUP
/* Not defined on win32 */
signal
(
SIGHUP
,
signal_cleanup
);
...
...
@@ -553,7 +569,13 @@ print_elapse(struct timeval start_t, struct timeval stop_t, int ops)
static
void
process_alarm
(
int
sig
)
{
#ifdef WIN32
sleep
(
secs_per_test
);
#endif
alarm_triggered
=
true
;
#ifdef WIN32
ExitThread
(
0
);
#endif
}
static
void
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment