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

Make unix.{localtime,gmtime} use reentrant c calls #5193

Closed
vicuna opened this issue Dec 10, 2010 · 5 comments
Closed

Make unix.{localtime,gmtime} use reentrant c calls #5193

vicuna opened this issue Dec 10, 2010 · 5 comments

Comments

@vicuna
Copy link

vicuna commented Dec 10, 2010

Original bug ID: 5193
Reporter: till
Status: acknowledged (set by @damiendoligez on 2010-12-14T15:10:34Z)
Resolution: open
Priority: normal
Severity: feature
Target version: later
Category: otherlibs
Tags: patch

Bug description

Attached is a patch to make it call out to {localtime,gmtime}_r which are the reentrant versions of these calls.

File attachments

@vicuna
Copy link
Author

vicuna commented Dec 10, 2010

Comment author: till

oops the category should have been the compiler. Please reassign.

@vicuna
Copy link
Author

vicuna commented Dec 22, 2010

Comment author: @xavierleroy

This change has been proposed before, but I am reluctant to implement it, for several reasons:

  • gmtime_r() is "less standard" than gmtime(), the latter being in ISO C.
  • All C libraries worth their salt implement gmtime() using thread-local storage, and are therefore thread-safe.
  • Two gmtime() calls from Caml cannot execute concurrently because of the global lock, so the only risk of a race is with a gmtime() executing concurrently in a C thread.

All in all, I'd rather not change the current code until the problem above manifests itself in practice.

@yallop
Copy link
Member

yallop commented Apr 4, 2019

See also: #3784.

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

@github-actions github-actions bot added the Stale label May 15, 2020
@stedolan stedolan removed the Stale label May 20, 2020
@stedolan stedolan self-assigned this May 20, 2020
@damiendoligez damiendoligez changed the title Make unix.{localtime,gmtime} use non reentrant c calls Make unix.{localtime,gmtime} use reentrant c calls Oct 14, 2020
@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

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

3 participants