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
1b4e8255
Commit
1b4e8255
authored
21 years ago
by
Bruce Momjian
Browse files
Options
Downloads
Patches
Plain Diff
Simplify thread test program.
parent
0fa2afa9
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/tools/thread/thread_test.c
+11
-38
11 additions, 38 deletions
src/tools/thread/thread_test.c
with
11 additions
and
38 deletions
src/tools/thread/thread_test.c
+
11
−
38
View file @
1b4e8255
...
...
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.1
8
2004/04/2
1
2
0
:58:
56
momjian Exp $
* $PostgreSQL: pgsql/src/tools/thread/thread_test.c,v 1.1
9
2004/04/2
2
2
3
:58:
03
momjian Exp $
*
* This program tests to see if your standard libc functions use
* pthread_setspecific()/pthread_getspecific() to be thread-safe.
...
...
@@ -28,7 +28,6 @@
#include
<sys/types.h>
#include
<pwd.h>
#include
<string.h>
#include
<errno.h>
#include
<fcntl.h>
#include
<errno.h>
...
...
@@ -54,9 +53,9 @@ struct passwd *passwd_p2;
struct
hostent
*
hostent_p1
;
struct
hostent
*
hostent_p2
;
bool
gethostbyname_threadsafe
;
bool
getpwuid_threadsafe
;
bool
strerror_threadsafe
;
bool
gethostbyname_threadsafe
=
false
;
bool
getpwuid_threadsafe
=
false
;
bool
strerror_threadsafe
=
false
;
bool
platform_is_threadsafe
=
true
;
pthread_mutex_t
init_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
...
...
@@ -92,42 +91,16 @@ defines to your template/$port file before compiling this program.\n\n"
while
(
thread1_done
==
0
||
thread2_done
==
0
)
sched_yield
();
/* if this is a portability problem, remove it */
fprintf
(
stderr
,
"errno is thread-safe
\n\n
"
);
printf
(
"Add this to your template/$port file:
\n\n
"
);
fprintf
(
stderr
,
"errno is thread-safe
\n
"
);
if
(
strerror_p1
!=
strerror_p2
)
{
printf
(
"STRERROR_THREADSAFE=yes
\n
"
);
strerror_threadsafe
=
true
;
}
else
{
printf
(
"STRERROR_THREADSAFE=no
\n
"
);
strerror_threadsafe
=
false
;
}
if
(
passwd_p1
!=
passwd_p2
)
{
printf
(
"GETPWUID_THREADSAFE=yes
\n
"
);
getpwuid_threadsafe
=
true
;
}
else
{
printf
(
"GETPWUID_THREADSAFE=no
\n
"
);
getpwuid_threadsafe
=
false
;
}
if
(
hostent_p1
!=
hostent_p2
)
{
printf
(
"GETHOSTBYNAME_THREADSAFE=yes
\n
"
);
gethostbyname_threadsafe
=
true
;
}
else
{
printf
(
"GETHOSTBYNAME_THREADSAFE=no
\n
"
);
gethostbyname_threadsafe
=
false
;
}
pthread_mutex_unlock
(
&
init_mutex
);
/* let children exit */
...
...
@@ -141,11 +114,11 @@ defines to your template/$port file before compiling this program.\n\n"
#else
printf
(
"Your system uses strerror() which is "
);
if
(
strerror_threadsafe
)
printf
(
"thread-safe
\n
"
);
printf
(
"thread-safe
.
\n
"
);
else
{
platform_is_threadsafe
=
false
;
printf
(
"not thread-safe
\n
"
);
printf
(
"not thread-safe
.
\n
"
);
}
#endif
...
...
@@ -154,11 +127,11 @@ defines to your template/$port file before compiling this program.\n\n"
#else
printf
(
"Your system uses getpwuid() which is "
);
if
(
getpwuid_threadsafe
)
printf
(
"thread-safe
\n
"
);
printf
(
"thread-safe
.
\n
"
);
else
{
platform_is_threadsafe
=
false
;
printf
(
"not thread-safe
\n
"
);
printf
(
"not thread-safe
.
\n
"
);
}
#endif
...
...
@@ -171,11 +144,11 @@ defines to your template/$port file before compiling this program.\n\n"
#else
printf
(
"Your system uses gethostbyname which is "
);
if
(
gethostbyname_threadsafe
)
printf
(
"thread-safe
\n
"
);
printf
(
"thread-safe
.
\n
"
);
else
{
platform_is_threadsafe
=
false
;
printf
(
"not thread-safe
\n
"
);
printf
(
"not thread-safe
.
\n
"
);
}
#endif
#endif
...
...
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