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

Windows support for registration of C threads from callbacks #450

Merged
merged 1 commit into from
Sep 27, 2016

Conversation

fdopen
Copy link
Contributor

@fdopen fdopen commented Sep 25, 2016

Follow up to #420, fix for #421.
Explanation is inside the source as comment.

@yallop
Copy link
Owner

yallop commented Sep 27, 2016

Wonderful! Thank you.

(We'll need tests for this eventually. Unfortunately there's not even a test for the pthreads version yet. But it's reported to work.)

@fdopen
Copy link
Contributor Author

fdopen commented Sep 28, 2016

For the windows case I had of course written a basic test that I could add to the test suite (a dll that spawns a few threads in parallel, each calling back several times to OCaml with its thread id)

The problem is that it's only easy to test that there is no segfault (as without thread registration). Testing that caml_c_thread_unregister/caml_thread_remove_info are called is however non-trivial. The compiler specific instruction https://github.com/ocamllabs/ocaml-ctypes/blob/50b39eed6fbf13f269c1460f9725dc86ea1b7063/src/ctypes-foreign-threaded/foreign_threaded_stubs.c#L54 could fail silently in the future (e.g. if support for a different compiler is added). But external tools (e.g. a gdb-script) are difficult to maintain.

@yallop
Copy link
Owner

yallop commented Sep 29, 2016

The problem is that it's only easy to test that there is no segfault

Right. But I think that's still useful, even if it doesn't tell you everything you'd like to know.

@fdopen fdopen deleted the windows-thread branch April 14, 2018 12:10
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.

2 participants