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

Add support for Lwt_preemptive #430

Merged
merged 5 commits into from
Aug 17, 2016
Merged

Add support for Lwt_preemptive #430

merged 5 commits into from
Aug 17, 2016

Conversation

yallop
Copy link
Owner

@yallop yallop commented Aug 16, 2016

This adds an extra value, Cstubs.lwt_preemptive, to the interface:

val lwt_preemptive : concurrency_policy
(** Generate code which runs C function calls with the Lwt_preemptive module:

    http://ocsigen.org/lwt/2.5.1/api/Lwt_preemptive

    Passing [lwt_preemptive] as the [concurrency] argument to {!Cstubs.write_c} and
    {!Cstubs.write_ml} changes the return type of bound functions to include
    the {!Lwt.t} constructor.  For example, the binding specification

       [let unlink = foreign "unlink" (string @-> returning int)]

    generates a value of the following type by default:

       [val unlink : string -> int]

    but when using [lwt_preemptive] the generated type is as follows:

       [val unlink : string -> int Lwt.t]

    Additionally, the OCaml runtime lock is released during calls to functions
    bound with [lwt_preemptive].
*)

Passing ~concurrency_policy:Cstubs.lwt_preemptive to the write_c and write_ml functions results in generated code that runs bound C functions with Lwt_preemptive.detach.

@yallop yallop merged commit 3ef96ff into yallop:master Aug 17, 2016
@yallop yallop deleted the lwt-preemptive branch August 17, 2016 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant