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
a101405b
Commit
a101405b
authored
Aug 13, 2002
by
heikki@hundin.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
os0thread.h, os0thread.c:
Fix a critical portability bug introduced in the Windows version
parent
49f65828
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
25 deletions
+25
-25
innobase/include/os0thread.h
innobase/include/os0thread.h
+13
-11
innobase/os/os0thread.c
innobase/os/os0thread.c
+12
-14
No files found.
innobase/include/os0thread.h
View file @
a101405b
...
@@ -25,33 +25,37 @@ can wait inside InnoDB */
...
@@ -25,33 +25,37 @@ can wait inside InnoDB */
#ifdef __WIN__
#ifdef __WIN__
typedef
void
*
os_thread_t
;
typedef
void
*
os_thread_t
;
typedef
ulint
os_thread_id_t
;
/* In Windows the thread id
is an unsigned long int */
#else
#else
typedef
pthread_t
os_thread_t
;
typedef
pthread_t
os_thread_t
;
typedef
os_thread_t
os_thread_id_t
;
/* In Unix we use the thread
handle itself as the id of
the thread */
#endif
#endif
#define os_thread_id_t os_thread_t
/* Define a function pointer type to use in a typecast */
/* Define a function pointer type to use in a typecast */
typedef
void
*
(
*
os_posix_f_t
)
(
void
*
);
typedef
void
*
(
*
os_posix_f_t
)
(
void
*
);
/*******************************************************************
/*******************************************************************
Compares two thread
s or thread ids for equality
*/
Compares two thread
ids for equality.
*/
ibool
ibool
os_thread_eq
(
os_thread_eq
(
/*=========*/
/*=========*/
/* out: TRUE if equal */
/* out: TRUE if equal */
os_thread_t
a
,
/* in: OS thread or thread id */
os_thread_
id_
t
a
,
/* in: OS thread or thread id */
os_thread_t
b
);
/* in: OS thread or thread id */
os_thread_
id_
t
b
);
/* in: OS thread or thread id */
/********************************************************************
/********************************************************************
Converts an OS thread
or thread id to a ulint. It is NOT guaranteed that
Converts an OS thread
id to a ulint. It is NOT guaranteed that the ulint is
the ulint is
unique for the thread though! */
unique for the thread though! */
ulint
ulint
os_thread_pf
(
os_thread_pf
(
/*=========*/
/*=========*/
/* out: unsigned long int */
/* out: unsigned long int */
os_thread_t
a
);
/* in: thread or thread id */
os_thread_
id_
t
a
);
/* in: thread or thread id */
/********************************************************************
/********************************************************************
Creates a new thread of execution. The execution starts from
Creates a new thread of execution. The execution starts from
the function given. The start function takes a void* parameter
the function given. The start function takes a void* parameter
...
@@ -69,10 +73,8 @@ os_thread_create(
...
@@ -69,10 +73,8 @@ os_thread_create(
#endif
#endif
void
*
arg
,
/* in: argument to start
void
*
arg
,
/* in: argument to start
function */
function */
os_thread_id_t
*
thread_id
);
/* out: id of created
os_thread_id_t
*
thread_id
);
/* out: id of the created
thread; currently this is
thread */
identical to the handle to
the thread */
/*********************************************************************
/*********************************************************************
A thread calling this function ends its execution. */
A thread calling this function ends its execution. */
...
...
innobase/os/os0thread.c
View file @
a101405b
...
@@ -19,14 +19,14 @@ Created 9/8/1995 Heikki Tuuri
...
@@ -19,14 +19,14 @@ Created 9/8/1995 Heikki Tuuri
#include "srv0srv.h"
#include "srv0srv.h"
/*******************************************************************
/*******************************************************************
Compares two thread
s or thread ids for equality
*/
Compares two thread
ids for equality.
*/
ibool
ibool
os_thread_eq
(
os_thread_eq
(
/*=========*/
/*=========*/
/* out: TRUE if equal */
/* out: TRUE if equal */
os_thread_t
a
,
/* in: OS thread or thread id */
os_thread_
id_
t
a
,
/* in: OS thread or thread id */
os_thread_t
b
)
/* in: OS thread or thread id */
os_thread_
id_
t
b
)
/* in: OS thread or thread id */
{
{
#ifdef __WIN__
#ifdef __WIN__
if
(
a
==
b
)
{
if
(
a
==
b
)
{
...
@@ -44,13 +44,13 @@ os_thread_eq(
...
@@ -44,13 +44,13 @@ os_thread_eq(
}
}
/********************************************************************
/********************************************************************
Converts an OS thread
or thread id to a ulint. It is NOT guaranteed that
Converts an OS thread
id to a ulint. It is NOT guaranteed that the ulint is
the ulint is
unique for the thread though! */
unique for the thread though! */
ulint
ulint
os_thread_pf
(
os_thread_pf
(
/*=========*/
/*=========*/
os_thread_t
a
)
os_thread_
id_
t
a
)
{
{
#ifdef UNIV_HPUX
#ifdef UNIV_HPUX
/* In HP-UX a pthread_t is a struct of 3 fields: field1, field2,
/* In HP-UX a pthread_t is a struct of 3 fields: field1, field2,
...
@@ -64,15 +64,15 @@ os_thread_pf(
...
@@ -64,15 +64,15 @@ os_thread_pf(
/*********************************************************************
/*********************************************************************
Returns the thread identifier of current thread. Currently the thread
Returns the thread identifier of current thread. Currently the thread
identifier i
s the thread handle itself. Note that in HP-UX pthread_t is
identifier i
n Unix is the thread handle itself. Note that in HP-UX
a struct of 3 fields. */
pthread_t is
a struct of 3 fields. */
os_thread_id_t
os_thread_id_t
os_thread_get_curr_id
(
void
)
os_thread_get_curr_id
(
void
)
/*=======================*/
/*=======================*/
{
{
#ifdef __WIN__
#ifdef __WIN__
return
(
GetCurrentThread
());
return
(
GetCurrentThread
Id
());
#else
#else
return
(
pthread_self
());
return
(
pthread_self
());
#endif
#endif
...
@@ -95,10 +95,8 @@ os_thread_create(
...
@@ -95,10 +95,8 @@ os_thread_create(
#endif
#endif
void
*
arg
,
/* in: argument to start
void
*
arg
,
/* in: argument to start
function */
function */
os_thread_id_t
*
thread_id
)
/* out: id of created
os_thread_id_t
*
thread_id
)
/* out: id of the created
thread; currently this is
thread */
identical to the handle to
the thread */
{
{
#ifdef __WIN__
#ifdef __WIN__
os_thread_t
thread
;
os_thread_t
thread
;
...
@@ -120,7 +118,7 @@ os_thread_create(
...
@@ -120,7 +118,7 @@ os_thread_create(
ut_a
(
SetThreadPriority
(
thread
,
srv_query_thread_priority
));
ut_a
(
SetThreadPriority
(
thread
,
srv_query_thread_priority
));
}
}
*
thread_id
=
threa
d
;
*
thread_id
=
win_thread_i
d
;
return
(
thread
);
return
(
thread
);
#else
#else
...
...
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