Skip to content
This repository was archived by the owner on Aug 27, 2020. It is now read-only.

Use unsafe for most of the FFI #18

Open
thumphries opened this issue May 19, 2018 · 3 comments
Open

Use unsafe for most of the FFI #18

thumphries opened this issue May 19, 2018 · 3 comments

Comments

@thumphries
Copy link
Owner

... except the stuff that uses FunPtr.

Important for throughput, but would like to have real tests before doing so

@nh2
Copy link

nh2 commented Nov 19, 2018

Wait, don't the C calls block (because they do networking)?

One must not use unsafe for anything that is not "instantantaneous" (that is, does only CPU-bound activity), because it blocks the entire CPU core (so you can have at maximum N unsafe operations at once for the N given in +RTS -N).

See haskell/unix#34 for more details.

@thumphries
Copy link
Owner Author

Most of this API is asynchronous, network IO is handled by a separate thread and the C bindings just throw requests onto a queue

@thumphries
Copy link
Owner Author

I do, however, frequently get confused between safe and unsafe. To rephrase the issue, "maximise concurrent throughput any way possible"

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants