| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
|
| |
Reviewers: bgamari, Phyx, austin, hvr, simonmar
Reviewed By: bgamari
Subscribers: syd, rwbarton, thomie
Differential Revision: https://phabricator.haskell.org/D4041
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
On 64-bit UNIX and Windows, Haskell `Int` has 64 bits
but C `int msecs` has 32 bits, resulting in an overflow.
This commit fixes it by switching fdReady() to take int64_t,
into which a Haskell `Int` will always fit.
(Note we could not switch to `long long` because that is
32 bit on 64-bit Windows machines.)
Further, to be able to actually wait longer than ~49 days,
we put loops around the waiting syscalls (they all accept only
32-bit integers).
Note the timer signal would typically interrupt the syscalls
before the ~49 days are over, but you can run Haskell programs
without the timer signal, an we want it to be correct in all
cases.
Reviewers: bgamari, austin, hvr, NicolasT, Phyx
Reviewed By: bgamari, Phyx
Subscribers: syd, Phyx, rwbarton, thomie
GHC Trac Issues: #14262
Differential Revision: https://phabricator.haskell.org/D4011
|
|
|
|
| |
Our new CPP linter enforces this.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Give `catch#` a lazy demand signature, to make it more honest.
* Make `catchException` and `catchAny` force their arguments so they
actually behave as advertised.
* Use `catch` rather than `catchException` in `forkIO`, `forkOn`, and
`forkOS` to avoid losing exceptions.
Fixes #13330
Reviewers: rwbarton, simonpj, simonmar, bgamari, hvr, austin
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D3244
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These are cases in the standard library that may benefit from the
strictness signature of catchException and where we know that the action
won't bottom.
Test Plan: Validate, carefully consider changed callsites
Reviewers: austin, hvr
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1972
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
A safe import is unnecessary considering rtsSupportsBoundThreads simply
returns a constant.
This commit doesn't fix the main issue of ticket #9696 that
"readRawBufferPtr and writeRawBufferPtr allocate memory".
Reviewers: bgamari, austin, hvr
Reviewed By: hvr
Subscribers: thomie
Differential Revision: https://phabricator.haskell.org/D1964
GHC Trac Issues: #9696
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This introduces "freezing," an operation which prevents further
locations from being appended to a CallStack. Library authors may want
to prevent CallStacks from exposing implementation details, as a matter
of hygiene. For example, in
```
head [] = error "head: empty list"
ghci> head []
*** Exception: head: empty list
CallStack (from implicit params):
error, called at ...
```
including the call-site of `error` in `head` is not strictly necessary
as the error message already specifies clearly where the error came
from.
So we add a function `freezeCallStack` that wraps an existing CallStack,
preventing further call-sites from being pushed onto it. In other words,
```
pushCallStack callSite (freezeCallStack callStack) = freezeCallStack callStack
```
Now we can define `head` to not produce a CallStack at all
```
head [] =
let ?callStack = freezeCallStack emptyCallStack
in error "head: empty list"
ghci> head []
*** Exception: head: empty list
CallStack (from implicit params):
error, called at ...
```
---
1. We add the `freezeCallStack` and `emptyCallStack` and update the
definition of `CallStack` to support this functionality.
2. We add `errorWithoutStackTrace`, a variant of `error` that does not
produce a stack trace, using this feature. I think this is a sensible
wrapper function to provide in case users want it.
3. We replace uses of `error` in base with `errorWithoutStackTrace`. The
rationale is that base does not export any functions that use CallStacks
(except for `error` and `undefined`) so there's no way for the stack
traces (from Implicit CallStacks) to include user-defined functions.
They'll only contain the call to `error` itself. As base already has a
good habit of providing useful error messages that name the triggering
function, the stack trace really just adds noise to the error. (I don't
have a strong opinion on whether we should include this third commit,
but the change was very mechanical so I thought I'd include it anyway in
case there's interest)
4. Updates tests in `array` and `stm` submodules
Test Plan: ./validate, new test is T11049
Reviewers: simonpj, nomeata, goldfire, austin, hvr, bgamari
Reviewed By: simonpj
Subscribers: thomie
Projects: #ghc
Differential Revision: https://phabricator.haskell.org/D1628
GHC Trac Issues: #11049
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This replaces some occurences of `-f(no-)warn` with the new `-W`-aliases
introduced via 2206fa8cdb120932 / #11218, in cases which are guaranteed
to be invoked with recent enough GHC (i.e. the stage1+ GHC).
After this commit, mostly the compiler and the testsuite remain using
`-f(wo-)warn...` because the compiler needs to be bootstrappable with
older GHCs, while for the testsuite it's convenient to be able to quickly
compare the behavior to older GHCs (which may not support the new flags yet).
The compiler-part can be updated to use the new flags once GHC 8.3 development
starts.
Reviewed By: quchen
Differential Revision: https://phabricator.haskell.org/D1637
|
|
|
|
|
|
|
|
|
|
| |
Fixes #8010, according to the specified libraries proposal. [1]
Also, some minor wordsmithing.
[1] http://thread.gmane.org/gmane.comp.lang.haskell.libraries/22709
Signed-off-by: Austin Seipp <austin@well-typed.com>
|
|
|
|
|
|
| |
Starting with Haddock 2.16 there's a new built-in support for since-annotations
Note: This exposes a bug in the `@since` implementation (see e.g. `Data.Bits`)
|
|
|
|
|
|
|
|
|
|
| |
This commit removes a couple of
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
by cleaning up the imports, as well as ensuring that all modules in the
GHC.* hierarchy avoid importing the `Prelude` module to clean-up the
import graph a bit.
|
|
|
|
| |
Since they're implied by the lack of `NoImplicitPrelude`
|
| |
|
|
|
|
|
|
|
|
|
| |
This allows several modules to avoid importing Control.Monad and thus break
import cycles that manifest themselves when implementing #9586
Reviewed By: austin, ekmett
Differential Revision: https://phabricator.haskell.org/D222
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Summary: Signed-off-by: Shachaf Ben-Kiki <shachaf@gmail.com>
Test Plan: n/a
Reviewers: austin
Reviewed By: austin
Subscribers: simonmar, relrod, carter
Differential Revision: https://phabricator.haskell.org/D57
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This removes language pragmas from Haskell modules which are implicitly
active with `default-language: Haskell2010`. Specifically, the following
language extension pragmas are removed by this commit:
- PatternGuards
- ForeignFunctionInterface
- EmptyDataDecls
- NoBangPatterns
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
|
|
| |
This commit retroactively adds `/Since: 4.6.0.0/` annotations to symbols
newly added/exposed in `base-4.6.0.0` (as shipped with GHC 7.6.1).
See also 6368362f which adds the respective annotation for symbols newly
added in `base-4.7.0.0` (that goes together with GHC 7.8.1).
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These annotations were added in such a way, that the line
{{{
/Since: 4.7.0.0/
}}}
represents the last paragraph of the Haddock comment.
Maybe Haddock will have support for this meta-syntax at some point, and
be able to inherited the since-version property to the children of an
annotated symbol and display the since-version property in the rendered
documentation only in cases when it's not visually obvious (for
instance, when re-exporting documentation strings).
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Now that HUGS and NHC specific code has been removed, this commit "folds"
the now redundant `#if((n)def)`s containing `__GLASGOW_HASKELL__`. This
renders `base` officially GHC only.
This commit also removes redundant `{-# LANGUAGE CPP #-}`.
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
|
|
|
|
|
|
| |
For rationale. see
http://permalink.gmane.org/gmane.comp.lang.haskell.ghc.devel/2349
Signed-off-by: Herbert Valerio Riedel <hvr@gnu.org>
|
| |
|
|
|
|
|
| |
7.2 is too old even to build HEAD, so seems reasonable to remove them
now.
|
| |
|
|
|
|
| |
I assume that we only want to catch IOExceptions, as withThread does.
|
|
|
|
| |
Supports threadWaitReadSTM and threadWaitWriteSTM on Windows with the threaded runtime system.
|
|
|
|
|
|
|
|
|
| |
We decided not to break existing users without providing an easy
migration path. For the time being I've made these implementations,
which fix the bugs in the old versions and perform reasonably well.
In due course we should move the concurrency functionality, including
these modules, out of base and into a separate package.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These comments are rather less useful now that haddock can give docs
with the same informatino in the module synopsis.
Having to maintain them when making changes to the library is a pain,
and when people forget about doing so there is nothing that checks that
the comments are right, so mistakes tend to linger.
Of the comments that my script detected, 78 of 684 were already
incorrect in one way or another, e.g. missing context:
Text.Show.showsPrec
Comment type: Int -> a -> ShowS
Actual type: Show a => Int -> a -> ShowS
wrong context:
Numeric.readInt
Comment type: Integral a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a
Actual type: Num a => a -> (Char -> Bool) -> (Char -> Int) -> ReadS a
not following a class change (e.g. Num losing its Eq superclass):
Text.Read.Lex.readOctP
Comment type: Num a => ReadP a
Actual type: (Eq a, Num a) => ReadP a
not following the Exceptions change:
GHC.Conc.childHandler
Comment type: Exception -> IO ()
Actual type: SomeException -> IO ()
or just always been wrong:
GHC.Stable.deRefStablePtr
Comment type: StablePtr a -> a
Actual type: StablePtr a -> IO a
|
| |
|
|
|
|
| |
Also Control.Concurrent.{mergeIO,nmergeIO}, which use those modules.
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is a more robust version of "forkIO (m `finally` k)", because it
closes a window between thread creation and the finally where the
thread can receive an async exception. Useful for layers over threads
that need to catch threads dying with absolute certainty.
forkFinally :: IO a -> (Either SomeException a -> IO ()) -> IO ThreadId
forkFinally action and_then =
mask $ \restore ->
forkIO $ try (restore action) >>= and_then
|
| |
|
|
|
|
|
| |
I hadn't noticed that we already have getNumCapabilities here, so we
should also have setNumCapabilities.
|
|
|
|
|
| |
Part of trac #5529. We also now import the constructors in various
modules that use them in FFI decls.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
forkOn :: Int -> IO () -> IO ThreadId
forkOnWithUnmask :: Int -> ((forall a . IO a -> IO a) -> IO ()) -> IO ThreadId
getNumCapabilities :: IO Int
threadCapability :: ThreadId -> IO (Int, Bool)
Following discussion on the libraries list, I renamed forkOnIO to
forkOn. In due course we might want to also rename forkIO to fork.
I left the Int argument as it is, it's quite useful to be able to
specify a number to be interpreted modulo the actual number of
processors.
I also used the term "capability" consistently. It might not be the
best choice, but we have to pick something.
|
|
|
|
|
|
|
|
|
| |
With forkIOUnmasked it wasn't possible to reliably set up an exception
handler in the child thread, because exceptions were immediately
unmasked.
forkIOWithUnmask :: ((forall a . IO a -> IO a) -> IO ()) -> IO ThreadId
forkOnIOWithUnmask :: Int -> ((forall a . IO a -> IO a) -> IO ()) -> IO ThreadId
|
|
|
|
|
|
|
|
|
|
| |
Add explicit {-# LANGUAGE xxx #-} pragmas to each module, that say
what extensions that module uses. This makes it clearer where
different extensions are used in the (large, variagated) base package.
Now base.cabal doesn't need any extensions field
Thanks to Bas van Dijk for doing all the work.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* The public APIs for threadWaitRead and threadWaitWrite remain unchanged,
and now throw an IOError if a file descriptor is closed behind their
backs. This behaviour is documented.
* The GHC.Conc API is extended to add a closeFd function, the behaviour
of which is documented.
* Behind the scenes, we add a new evtClose event, which is used only when
one thread closes a file descriptor that other threads are blocking on.
* Both base's IO code and network use the new closeFd function.
|
| |
|
|
|
|
| |
runInUnboundThread
|
|
|
|
| |
when we have mask
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
As discussed on the libraries/haskell-cafe mailing lists
http://www.haskell.org/pipermail/libraries/2010-April/013420.html
This is a replacement for block/unblock in the asychronous exceptions
API to fix a problem whereby a function could unblock asynchronous
exceptions even if called within a blocked context.
The new terminology is "mask" rather than "block" (to avoid confusion
due to overloaded meanings of the latter).
The following is the new API; the old API is deprecated but still
available for the time being.
Control.Exception
-----------------
mask :: ((forall a. IO a -> IO a) -> IO b) -> IO b
mask_ :: IO a -> IO a
uninterruptibleMask :: ((forall a. IO a -> IO a) -> IO b) -> IO b
uninterruptibleMask_ :: IO a -> IO
getMaskingState :: IO MaskingState
data MaskingState
= Unmasked
| MaskedInterruptible
| MaskedUninterruptible
Control.Concurrent
------------------
forkIOUnmasked :: IO () -> IO ThreadId
|
|
|
|
|
|
| |
Note that I don't unblock the given io computation. Because AFAICS
withThread is only called with 'waitFd' which only performs an FFI
call which can't receive asynchronous exceptions anyway.
|
|
|
|
| |
exception handler
|
| |
|