Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
dc25c00f
Commit
dc25c00f
authored
Jul 30, 2008
by
Simon Marlow
Browse files
workaround #2277: turn off the RTS timer when calling into editline
parent
5ef63d19
Changes
2
Hide whitespace changes
Inline
Side-by-side
compiler/ghci/InteractiveUI.hs
View file @
dc25c00f
...
...
@@ -321,7 +321,7 @@ interactiveUI session srcs maybe_exprs = do
#
ifdef
USE_EDITLINE
is_tty
<-
hIsTerminalDevice
stdin
when
is_tty
$
do
when
is_tty
$
withReadline
$
do
Readline
.
initialize
withGhcAppData
...
...
@@ -614,9 +614,7 @@ readlineLoop = do
io
yield
saveSession
-- for use by completion
prompt
<-
mkPrompt
l
<-
io
(
readline
prompt
`
finally
`
setNonBlockingFD
0
)
-- readline sometimes puts stdin into blocking mode,
-- so we need to put it back for the IO library
l
<-
io
$
withReadline
(
readline
prompt
)
splatSavedSession
case
l
of
Nothing
->
return
Nothing
...
...
@@ -625,6 +623,20 @@ readlineLoop = do
io
(
addHistory
l
)
str
<-
io
$
consoleInputToUnicode
True
l
return
(
Just
str
)
withReadline
::
IO
a
->
IO
a
withReadline
=
bracket_
stopTimer
(
do
startTimer
;
setNonBlockingFD
0
)
-- Two problems are being worked around here:
-- 1. readline sometimes puts stdin into blocking mode,
-- so we need to put it back for the IO library
-- 2. editline doesn't handle some of its system calls returning
-- EINTR, so our timer signal confuses it, hence we turn off
-- the timer signal when making calls to editline. (#2277)
-- If editline is ever fixed, we can remove this.
-- These come from the RTS
foreign
import
ccall
unsafe
startTimer
::
IO
()
foreign
import
ccall
unsafe
stopTimer
::
IO
()
#
endif
queryQueue
::
GHCi
(
Maybe
String
)
...
...
rts/Linker.c
View file @
dc25c00f
...
...
@@ -27,6 +27,7 @@
#include
"Schedule.h"
#include
"Sparks.h"
#include
"RtsTypeable.h"
#include
"Timer.h"
#ifdef HAVE_SYS_TYPES_H
#include
<sys/types.h>
...
...
@@ -703,6 +704,7 @@ typedef struct _RtsSymbolVal {
SymX(stackOverflow) \
SymX(stg_CAF_BLACKHOLE_info) \
SymX(awakenBlockedQueue) \
SymX(startTimer) \
SymX(stg_CHARLIKE_closure) \
SymX(stg_MVAR_CLEAN_info) \
SymX(stg_MVAR_DIRTY_info) \
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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