Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
513a1cd1
Commit
513a1cd1
authored
Jan 19, 2003
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Windows flavor of floatsleep(): folded long lines, introduced a temp
var for clarity.
parent
80cebc16
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
Modules/timemodule.c
Modules/timemodule.c
+17
-12
No files found.
Modules/timemodule.c
View file @
513a1cd1
...
...
@@ -455,7 +455,7 @@ time_strptime(PyObject *self, PyObject *args)
{
PyObject
*
strptime_module
=
PyImport_ImportModule
(
"_strptime"
);
if
(
!
strptime_module
)
if
(
!
strptime_module
)
return
NULL
;
return
PyObject_CallMethod
(
strptime_module
,
"strptime"
,
"O"
,
args
);
}
...
...
@@ -811,26 +811,31 @@ floatsleep(double secs)
#elif defined(MS_WINDOWS)
{
double
millisecs
=
secs
*
1000
.
0
;
unsigned
long
ul_millis
;
if
(
millisecs
>
(
double
)
ULONG_MAX
)
{
PyErr_SetString
(
PyExc_OverflowError
,
"sleep length is too large"
);
PyErr_SetString
(
PyExc_OverflowError
,
"sleep length is too large"
);
return
-
1
;
}
Py_BEGIN_ALLOW_THREADS
/* allow sleep(0) to maintain win32 semantics, and as decreed by
Guido, only the main thread can be interrupted. */
if
((
unsigned
long
)
millisecs
==
0
||
main_thread
!=
PyThread_get_thread_ident
())
Sleep
((
unsigned
long
)
millisecs
);
/* Allow sleep(0) to maintain win32 semantics, and as decreed
* by Guido, only the main thread can be interrupted.
*/
ul_millis
=
(
unsigned
long
)
millisecs
;
if
(
ul_millis
==
0
||
main_thread
!=
PyThread_get_thread_ident
())
Sleep
(
ul_millis
);
else
{
DWORD
rc
;
ResetEvent
(
hInterruptEvent
);
rc
=
WaitForSingleObject
(
hInterruptEvent
,
(
unsigned
long
)
millisecs
);
if
(
rc
==
WAIT_OBJECT_0
)
{
/* yield to make sure real Python signal handler called */
rc
=
WaitForSingleObject
(
hInterruptEvent
,
ul_millis
);
if
(
rc
==
WAIT_OBJECT_0
)
{
/* Yield to make sure real Python signal
* handler called.
*/
Sleep
(
1
);
Py_BLOCK_THREADS
/* PyErr_SetFromErrno() does the "right thing" wrt signals
if errno=EINTR
*/
errno
=
EINTR
;
PyErr_SetFromErrno
(
PyExc_IOError
);
return
-
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