Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
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
go
Commits
2ca46a78
Commit
2ca46a78
authored
Mar 17, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
time: isolate syscall reference in sys.go
R=dsymonds CC=golang-dev
https://golang.org/cl/4291052
parent
bc353797
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
src/pkg/time/sleep.go
src/pkg/time/sleep.go
+2
-3
src/pkg/time/sys.go
src/pkg/time/sys.go
+11
-3
No files found.
src/pkg/time/sleep.go
View file @
2ca46a78
...
...
@@ -5,9 +5,8 @@
package
time
import
(
"syscall"
"sync"
"container/heap"
"sync"
)
// The Timer type represents a single event.
...
...
@@ -126,7 +125,7 @@ func sleeper(sleeperId int64) {
dt
=
maxSleepTime
}
timerMutex
.
Unlock
()
sys
call
.
Sleep
(
dt
)
sysSleep
(
dt
)
timerMutex
.
Lock
()
if
currentSleeper
!=
sleeperId
{
// Another sleeper has been started, making this one redundant.
...
...
src/pkg/time/sys.go
View file @
2ca46a78
...
...
@@ -44,11 +44,19 @@ func sleep(t, ns int64) (int64, os.Error) {
// TODO(cw): use monotonic-time once it's available
end
:=
t
+
ns
for
t
<
end
{
err
no
:=
syscall
.
Sleep
(
end
-
t
)
if
err
no
!=
0
&&
errno
!=
syscall
.
EINTR
{
return
0
,
os
.
NewSyscallError
(
"sleep"
,
errno
)
err
:=
sys
Sleep
(
end
-
t
)
if
err
!=
nil
{
return
0
,
err
}
t
=
Nanoseconds
()
}
return
t
,
nil
}
func
sysSleep
(
t
int64
)
os
.
Error
{
errno
:=
syscall
.
Sleep
(
t
)
if
errno
!=
0
&&
errno
!=
syscall
.
EINTR
{
return
os
.
NewSyscallError
(
"sleep"
,
errno
)
}
return
nil
}
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