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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
054e7894
Commit
054e7894
authored
Aug 16, 2005
by
jimw@mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SLEEP() to be interruptable. (Bug #12582)
parent
41c93e36
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
2 deletions
+35
-2
include/my_global.h
include/my_global.h
+7
-0
sql/item_func.cc
sql/item_func.cc
+28
-2
No files found.
include/my_global.h
View file @
054e7894
...
@@ -939,6 +939,13 @@ typedef char bool; /* Ordinary boolean values 0 1 */
...
@@ -939,6 +939,13 @@ typedef char bool; /* Ordinary boolean values 0 1 */
#endif
/* HAVE_TIMESPEC_TS_SEC */
#endif
/* HAVE_TIMESPEC_TS_SEC */
#endif
/* set_timespec */
#endif
/* set_timespec */
#define set_timespec_nsec(ABSTIME,NSEC) \
{\
ulonglong now= my_getsystime(); \
(ABSTIME).tv_sec= (now / ULL(10000000)) + (NSEC / ULL(1000000000)); \
(ABSTIME).tv_nsec= (now % ULL(10000000)) * 100 + (NSEC % ULL(1000000000)); \
}
/*
/*
Define-funktions for reading and storing in machine independent format
Define-funktions for reading and storing in machine independent format
(low byte first)
(low byte first)
...
...
sql/item_func.cc
View file @
054e7894
...
@@ -3266,10 +3266,36 @@ void Item_func_benchmark::print(String *str)
...
@@ -3266,10 +3266,36 @@ void Item_func_benchmark::print(String *str)
longlong
Item_func_sleep
::
val_int
()
longlong
Item_func_sleep
::
val_int
()
{
{
THD
*
thd
=
current_thd
;
struct
timespec
abstime
;
pthread_cond_t
cond
;
int
error
=
0
;
DBUG_ASSERT
(
fixed
==
1
);
DBUG_ASSERT
(
fixed
==
1
);
double
time
=
args
[
0
]
->
val_real
();
double
time
=
args
[
0
]
->
val_real
();
my_sleep
((
ulong
)
time
*
1000000L
);
set_timespec_nsec
(
abstime
,
(
ulonglong
)(
time
*
ULL
(
1000000000
)));
return
0
;
pthread_cond_init
(
&
cond
,
NULL
);
pthread_mutex_lock
(
&
LOCK_user_locks
);
thd
->
mysys_var
->
current_mutex
=
&
LOCK_user_locks
;
thd
->
mysys_var
->
current_cond
=
&
cond
;
while
(
!
thd
->
killed
&&
(
error
=
pthread_cond_timedwait
(
&
cond
,
&
LOCK_user_locks
,
&
abstime
)
!=
ETIMEDOUT
)
&&
error
!=
EINVAL
)
;
pthread_mutex_lock
(
&
thd
->
mysys_var
->
mutex
);
thd
->
mysys_var
->
current_mutex
=
0
;
thd
->
mysys_var
->
current_cond
=
0
;
pthread_mutex_unlock
(
&
thd
->
mysys_var
->
mutex
);
pthread_mutex_unlock
(
&
LOCK_user_locks
);
pthread_cond_destroy
(
&
cond
);
return
(
error
==
ETIMEDOUT
)
?
0
:
1
;
}
}
...
...
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