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
4d25b1e1
Commit
4d25b1e1
authored
Dec 08, 2006
by
lars@black.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge mysql.com:/home/bk/MERGE/mysql-5.0-merge
into mysql.com:/home/bk/MERGE/mysql-5.1-merge
parents
d85ca0dc
d78bcf2c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
1 deletion
+58
-1
include/my_pthread.h
include/my_pthread.h
+19
-1
mysys/my_thr_init.c
mysys/my_thr_init.c
+39
-0
No files found.
include/my_pthread.h
View file @
4d25b1e1
...
...
@@ -31,8 +31,26 @@ extern "C" {
#define EXTERNC
#endif
/* __cplusplus */
#if defined(__WIN__)
/*
BUG#24507: Race conditions inside current NPTL pthread_exit() implementation.
If macro NPTL_PTHREAD_EXIT_HACK is defined then a hack described in the bug
report will be implemented inside my_thread_global_init() in my_thr_init.c.
This amounts to spawning a dummy thread which does nothing but executes
pthread_exit(0).
This bug is fixed in version 2.5 of glibc library.
TODO: Remove this code when fixed versions of glibc6 are in common use.
*/
#if defined(TARGET_OS_LINUX) && defined(HAVE_NPTL) && \
defined(__GLIBC__) && ( __GLIBC__ < 2 || __GLIBC__ == 2 && __GLIBC_MINOR__ < 5 )
#define NPTL_PTHREAD_EXIT_BUG 1
#endif
#if defined(__WIN__)
typedef
CRITICAL_SECTION
pthread_mutex_t
;
typedef
HANDLE
pthread_t
;
typedef
struct
thread_attr
{
...
...
mysys/my_thr_init.c
View file @
4d25b1e1
...
...
@@ -47,6 +47,23 @@ pthread_mutexattr_t my_fast_mutexattr;
pthread_mutexattr_t
my_errorcheck_mutexattr
;
#endif
#ifdef NPTL_PTHREAD_EXIT_BUG
/* see my_pthread.h */
/*
Dummy thread spawned in my_thread_global_init() below to avoid
race conditions in NPTL pthread_exit code.
*/
static
pthread_handler_t
nptl_pthread_exit_hack_handler
(
void
*
arg
)
{
/* Do nothing! */
pthread_exit
(
0
);
return
0
;
}
#endif
/*
initialize thread environment
...
...
@@ -65,6 +82,28 @@ my_bool my_thread_global_init(void)
fprintf
(
stderr
,
"Can't initialize threads: error %d
\n
"
,
errno
);
return
1
;
}
#ifdef NPTL_PTHREAD_EXIT_BUG
/*
BUG#24507: Race conditions inside current NPTL pthread_exit() implementation.
To avoid a possible segmentation fault during concurrent executions of
pthread_exit(), a dummy thread is spawned which initializes internal variables
of pthread lib. See bug description for thoroughfull explanation.
TODO: Remove this code when fixed versions of glibc6 are in common use.
*/
pthread_t
dummy_thread
;
pthread_attr_t
dummy_thread_attr
;
pthread_attr_init
(
&
dummy_thread_attr
);
pthread_attr_setdetachstate
(
&
dummy_thread_attr
,
PTHREAD_CREATE_DETACHED
);
pthread_create
(
&
dummy_thread
,
&
dummy_thread_attr
,
nptl_pthread_exit_hack_handler
,
NULL
);
#endif
#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
/*
...
...
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