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

Release the runtime system when calling caml_dlopen #6078

Closed
vicuna opened this issue Jul 16, 2013 · 10 comments
Closed

Release the runtime system when calling caml_dlopen #6078

vicuna opened this issue Jul 16, 2013 · 10 comments
Milestone

Comments

@vicuna
Copy link

vicuna commented Jul 16, 2013

Original bug ID: 6078
Reporter: @diml
Assigned to: @diml
Status: closed (set by @xavierleroy on 2016-12-07T10:49:02Z)
Resolution: fixed
Priority: low
Severity: minor
Version: 4.00.1
Target version: 4.02.2+dev / +rc1
Fixed in version: 4.02.2+dev / +rc1
Category: runtime system and C interface
Tags: patch

Bug description

dlopen is a blocking operation so it should release the global lock. The attached patch does this.

File attachments

@vicuna
Copy link
Author

vicuna commented Feb 26, 2015

Comment author: @damiendoligez

The patch looks good. Is there any reason not to apply it now?

@vicuna
Copy link
Author

vicuna commented Feb 27, 2015

Comment author: @diml

I think it can be applied. I updated the patch to use caml_strdup.

@vicuna
Copy link
Author

vicuna commented Mar 3, 2015

Comment author: @diml

Unless someone object I'll merge it.

@vicuna
Copy link
Author

vicuna commented Mar 5, 2015

Comment author: @diml

Committed in trunk (15878) and 4.02 (15879).

@vicuna
Copy link
Author

vicuna commented Mar 5, 2015

Comment author: @chambart

Are you certain that dlopen is thread safe ? Couldn't there be strange stuff happening if multiple libraries are loaded at the same time ?

@vicuna
Copy link
Author

vicuna commented Mar 6, 2015

Comment author: @diml

I'm not sure it is, but even if it is not it is not a reason to block the runtime. We shouldn't use the same mutex for every library call that is not thread-safe.

@vicuna
Copy link
Author

vicuna commented Mar 6, 2015

Comment author: @whitequark

I've looked into it a bit and it appears that on major platforms (Windows, Linux, OS X) the dynamic linker serializes the calls. POSIX doesn't specify this though, and NetBSD doesn't bother. (Does OCaml run on NetBSD?)

@vicuna
Copy link
Author

vicuna commented Mar 25, 2015

Comment author: @johnwhitington

This patch causes a warning on OS X under the latest XCode:

dynlink.c:122:3: warning: implicit declaration of function 'caml_enter_blocking_section' is invalid in C99 [-Wimplicit-function-declaration]
caml_enter_blocking_section();
^
dynlink.c:124:3: warning: implicit declaration of function 'caml_leave_blocking_section' is invalid in C99 [-Wimplicit-function-declaration]
caml_leave_blocking_section();
^

@vicuna
Copy link
Author

vicuna commented Mar 25, 2015

Comment author: @diml

Ah indeed, I forgot to include signals.h. I'll fix that, thanks!

@vicuna
Copy link
Author

vicuna commented Mar 25, 2015

Comment author: @diml

Committed in trunk (15963) and 4.02 (15962).

@vicuna vicuna closed this as completed Dec 7, 2016
@vicuna vicuna added the stdlib label Mar 14, 2019
@vicuna vicuna added this to the 4.02.2 milestone Mar 14, 2019
@vicuna vicuna assigned ghost Mar 14, 2019
@vicuna vicuna added the bug label Mar 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant