Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
95417c33
Commit
95417c33
authored
Aug 06, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backported pthread_mutex_trylock code from MySQL 4.0 to fix problem on HPUX.
Removed Heikki's patch for handling this.
parent
7917a18b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
11 deletions
+33
-11
configure.in
configure.in
+2
-2
include/my_pthread.h
include/my_pthread.h
+10
-7
mysys/my_pthread.c
mysys/my_pthread.c
+21
-2
No files found.
configure.in
View file @
95417c33
...
@@ -849,8 +849,8 @@ case $SYSTEM_TYPE in
...
@@ -849,8 +849,8 @@ case $SYSTEM_TYPE in
;;
;;
*
hpux10.20
*
)
*
hpux10.20
*
)
echo
"Enabling workarounds for hpux 10.20"
echo
"Enabling workarounds for hpux 10.20"
CFLAGS
=
"
$CFLAGS
-DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT
-DPTHREAD_MUTEX_TRYLOCK_INVERTED_RET_VAL
"
CFLAGS
=
"
$CFLAGS
-DHAVE_BROKEN_SNPRINTF -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
CXXFLAGS
=
"
$CXXFLAGS
-DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT
-DPTHREAD_MUTEX_TRYLOCK_INVERTED_RET_VAL
"
CXXFLAGS
=
"
$CXXFLAGS
-DHAVE_BROKEN_SNPRINTF -D_INCLUDE_LONGLONG -DSIGNALS_DONT_BREAK_READ -DDO_NOT_REMOVE_THREAD_WRAPPERS -DHPUX -DSIGNAL_WITH_VIO_CLOSE -DHAVE_BROKEN_PTHREAD_COND_TIMEDWAIT"
if
test
"
$with_named_thread
"
=
"no"
if
test
"
$with_named_thread
"
=
"no"
then
then
echo
"Using --with-named-thread=-lpthread"
echo
"Using --with-named-thread=-lpthread"
...
...
include/my_pthread.h
View file @
95417c33
...
@@ -428,6 +428,16 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
...
@@ -428,6 +428,16 @@ struct tm *localtime_r(const time_t *clock, struct tm *res);
#endif
/* defined(__WIN__) */
#endif
/* defined(__WIN__) */
#if defined(HPUX) && !defined(DONT_REMAP_PTHREAD_FUNCTIONS)
#undef pthread_cond_timedwait
#undef pthread_mutex_trylock
#define pthread_cond_timedwait(a,b,c) my_pthread_cond_timedwait((a),(b),(c))
#define pthread_mutex_trylock(a) my_pthread_mutex_trylock((a))
int
my_pthread_cond_timedwait
(
pthread_cond_t
*
cond
,
pthread_mutex_t
*
mutex
,
struct
timespec
*
abstime
);
int
my_pthread_mutex_trylock
(
pthread_mutex_t
*
mutex
);
#endif
/* safe_mutex adds checking to mutex for easier debugging */
/* safe_mutex adds checking to mutex for easier debugging */
typedef
struct
st_safe_mutex_t
typedef
struct
st_safe_mutex_t
...
@@ -464,14 +474,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
...
@@ -464,14 +474,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp,
#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)
#define pthread_mutex_destroy(A) safe_mutex_destroy((A),__FILE__,__LINE__)
#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__)
#define pthread_cond_wait(A,B) safe_cond_wait((A),(B),__FILE__,__LINE__)
#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
#define pthread_cond_timedwait(A,B,C) safe_cond_timedwait((A),(B),(C),__FILE__,__LINE__)
#ifdef PTHREAD_MUTEX_TRYLOCK_INVERTED_RET_VAL
/* In HP-UX-10.20 and other old Posix 1003.4a Draft 4 implementations
pthread_mutex_trylock returns 1 on success, not 0 like
pthread_mutex_lock */
#define pthread_mutex_trylock(A) (1 - pthread_mutex_lock(A))
#else
#define pthread_mutex_trylock(A) pthread_mutex_lock(A)
#define pthread_mutex_trylock(A) pthread_mutex_lock(A)
#endif
#define pthread_mutex_t safe_mutex_t
#define pthread_mutex_t safe_mutex_t
#endif
/* SAFE_MUTEX */
#endif
/* SAFE_MUTEX */
...
...
mysys/my_pthread.c
View file @
95417c33
...
@@ -409,7 +409,7 @@ int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr)
...
@@ -409,7 +409,7 @@ int my_pthread_cond_init(pthread_cond_t *mp, const pthread_condattr_t *attr)
/* Change functions on HP to work according to POSIX */
/* Change functions on HP to work according to POSIX */
#if
def HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT
#if
defined(HPUX) || defined(HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT)
#undef pthread_cond_timedwait
#undef pthread_cond_timedwait
int
my_pthread_cond_timedwait
(
pthread_cond_t
*
cond
,
int
my_pthread_cond_timedwait
(
pthread_cond_t
*
cond
,
...
@@ -426,7 +426,26 @@ int my_pthread_cond_timedwait(pthread_cond_t *cond,
...
@@ -426,7 +426,26 @@ int my_pthread_cond_timedwait(pthread_cond_t *cond,
error
=
ETIMEDOUT
;
error
=
ETIMEDOUT
;
return
error
;
return
error
;
}
}
#endif
/* HAVE_BROKEN_PTHREAD_COND_TIMEDWAIT */
#endif
#ifdef HPUX
/*
In HP-UX-10.20 and other old Posix 1003.4a Draft 4 implementations
pthread_mutex_trylock returns 1 on success, not 0 like
pthread_mutex_lock
*/
int
my_pthread_mutex_trylock
(
pthread_mutex_t
*
mutex
)
{
int
error
=
pthread_mutex_trylock
(
mutex
);
if
(
error
==
1
)
/* Safety if the lib is fixed */
return
0
;
/* Mutex was locked */
if
(
error
==
-
1
)
/* Safety if the lib is fixed */
error
=
errno
;
return
error
;
}
#endif
/* Some help functions */
/* Some help functions */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment