Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce flag for overall FFI calls safe/unsafe behaviour #140

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions unix.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,20 @@ source-repository head
type: git
location: https://github.com/haskell/unix.git

flag unsafe
description: Declare all FFI calls 'unsafe'. This results in faster
performance, but calls that block in the kernel might
result in overly long GC or other hard to debug issues.
default: True

library
default-language: Haskell2010
default-extensions:
CPP
InterruptibleFFI
other-extensions:
CApiFFI
CPP
DeriveDataTypeable
InterruptibleFFI
NondecreasingIndentation
RankNTypes
RecordWildCards
Expand Down Expand Up @@ -131,6 +138,12 @@ library

ghc-options: -Wall

cpp-options: -DFFI_UNSAFE=unsafe
if flag(unsafe)
cpp-options: -DFFI_SAFE=unsafe -DFFI_INTR=unsafe
else
cpp-options: -DFFI_SAFE=safe -DFFI_INTR=interruptible

include-dirs: include
includes:
HsUnix.h
Expand Down