Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
GHC
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kamil
GHC
Commits
4adffe35
Commit
4adffe35
authored
4 years ago
by
Kamil
Browse files
Options
Downloads
Patches
Plain Diff
Clarify interruptible FFI wrt masking state
parent
274e21f0
Branches
interruptible-guide
No related tags found
No related merge requests found
Pipeline
#26660
passed with warnings with stages
in 6 hours, 14 minutes, and 30 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/users_guide/exts/ffi.rst
+7
-4
7 additions, 4 deletions
docs/users_guide/exts/ffi.rst
with
7 additions
and
4 deletions
docs/users_guide/exts/ffi.rst
+
7
−
4
View file @
4adffe35
...
...
@@ -315,9 +315,10 @@ be annotated with ``interruptible`` instead of ``safe`` or ``unsafe``: ::
"sleep" sleepBlock :: CUint -> IO CUint
``interruptible`` behaves exactly as ``safe``, except that when a
``throwTo`` is directed at a thread in an interruptible foreign call, an
OS-specific mechanism will be used to attempt to cause the foreign call
to return:
``throwTo`` is directed at a thread in an interruptible foreign call,
irrespective of the masking state, the exception is added to the blocked
exceptions queue of the target thread and an OS-specific mechanism will be
used to attempt to cause the foreign call to return:
Unix systems
The thread making the foreign call is sent a ``SIGPIPE`` signal
...
...
@@ -333,7 +334,9 @@ Windows systems
Once the system call is successfully interrupted, the surrounding
code must return control out of the ``foreign import``, back into Haskell code,
so that the ``throwTo`` Haskell exception can be raised there.
so that any blocked exception can be raised if the masking state
of the thread allows it. Being under mask gives the Haskell code an opportunity
to detect and react to the interrupt error code from the c call.
If the foreign code simply retries the system call directly without returning
back to Haskell, then the intended effect of `interruptible` disappears
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment