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
299f0f20
Commit
299f0f20
authored
Oct 04, 2010
by
Bjorn Munch
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Follow-up to 54861, cannot assume pthread_t is integral type
parent
e688b6c2
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
7 deletions
+9
-7
client/mysqltest.cc
client/mysqltest.cc
+9
-7
No files found.
client/mysqltest.cc
View file @
299f0f20
...
...
@@ -259,6 +259,7 @@ struct st_connection
pthread_mutex_t
result_mutex
;
pthread_cond_t
result_cond
;
int
query_done
;
my_bool
has_thread
;
#endif
/*EMBEDDED_LIBRARY*/
};
...
...
@@ -770,7 +771,7 @@ end_thread:
static
void
wait_query_thread_done
(
struct
st_connection
*
con
)
{
DBUG_ASSERT
(
con
->
ti
d
);
DBUG_ASSERT
(
con
->
has_threa
d
);
if
(
!
con
->
query_done
)
{
pthread_mutex_lock
(
&
con
->
result_mutex
);
...
...
@@ -783,7 +784,7 @@ static void wait_query_thread_done(struct st_connection *con)
static
void
signal_connection_thd
(
struct
st_connection
*
cn
,
int
command
)
{
DBUG_ASSERT
(
cn
->
ti
d
);
DBUG_ASSERT
(
cn
->
has_threa
d
);
cn
->
query_done
=
0
;
cn
->
command
=
command
;
pthread_mutex_lock
(
&
cn
->
query_mutex
);
...
...
@@ -795,13 +796,13 @@ static void signal_connection_thd(struct st_connection *cn, int command)
/*
Sometimes we try to execute queries when the connection is closed.
It's done to make sure it was closed completely.
So that if our connection is closed (cn->
ti
d == 0), we just return
So that if our connection is closed (cn->
has_threa
d == 0), we just return
the mysql_send_query() result which is an error in this case.
*/
static
int
do_send_query
(
struct
st_connection
*
cn
,
const
char
*
q
,
int
q_len
)
{
if
(
!
cn
->
ti
d
)
if
(
!
cn
->
has_threa
d
)
return
mysql_send_query
(
&
cn
->
mysql
,
q
,
q_len
);
cn
->
cur_query
=
q
;
cn
->
cur_query_len
=
q_len
;
...
...
@@ -811,7 +812,7 @@ static int do_send_query(struct st_connection *cn, const char *q, int q_len)
static
int
do_read_query_result
(
struct
st_connection
*
cn
)
{
DBUG_ASSERT
(
cn
->
ti
d
);
DBUG_ASSERT
(
cn
->
has_threa
d
);
wait_query_thread_done
(
cn
);
signal_connection_thd
(
cn
,
EMB_READ_QUERY_RESULT
);
wait_query_thread_done
(
cn
);
...
...
@@ -822,12 +823,12 @@ static int do_read_query_result(struct st_connection *cn)
static
void
emb_close_connection
(
struct
st_connection
*
cn
)
{
if
(
!
cn
->
ti
d
)
if
(
!
cn
->
has_threa
d
)
return
;
wait_query_thread_done
(
cn
);
signal_connection_thd
(
cn
,
EMB_END_CONNECTION
);
pthread_join
(
cn
->
tid
,
NULL
);
cn
->
tid
=
0
;
cn
->
has_thread
=
FALSE
;
pthread_mutex_destroy
(
&
cn
->
query_mutex
);
pthread_cond_destroy
(
&
cn
->
query_cond
);
pthread_mutex_destroy
(
&
cn
->
result_mutex
);
...
...
@@ -845,6 +846,7 @@ static void init_connection_thd(struct st_connection *cn)
pthread_cond_init
(
&
cn
->
result_cond
,
NULL
)
||
pthread_create
(
&
cn
->
tid
,
&
cn_thd_attrib
,
connection_thread
,
(
void
*
)
cn
))
die
(
"Error in the thread library"
);
cn
->
has_thread
=
TRUE
;
}
#else
/*EMBEDDED_LIBRARY*/
...
...
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