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 lock_definitions.h #22283

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from

Conversation

khwilliamson
Copy link
Contributor

This file is intended to insulate C code from thread issues, when used as directed.

MANIFEST Outdated Show resolved Hide resolved
This file is intended to insulate C code from thread issues, when used
as directed.
if $entry->{locks} || $entry->{categories};
print $l <<~EOT;
#${dindent}define ${USE}_LOCK \\
#${dindent} error_${use}_not_suitable_for_multi-threaded_operation
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this generate:

#  error_foo_not suitable...

rather than

#  error foo_not suitable...

?
The first may produce an error, but it might not include the text of the symbol.

The second will produce the requested message, though it might be better to quote it, which will prevent macro replacement, allowing you to avoid the need for all_the_underscores.

# previous preprocessor lines. If there was no "#else" line, macros expanding
# to no-ops are automatically generated for the #else case.

__DATA__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues, in general:

  1. This defines a huge number of names most of which will never be used, and have a potential to conflict with names from other libraries.

I think this should add a PERL_ prefix to each lock name.

  1. This defines separate symbols for each function in a closely related group of functions, for example dbm_* and any read locale function.

The separate macros imply the need to do each of those locks, even though in some cases it doesn't make sense, eg. if I do a dbm_delete(), I really don't want to release the lock until I do dbm_error().

I think macros should be defined for groups of such functions where it makes sense, eg. a single macro for the dbm_* functions, and just document the need for LC_*_LOCK for locale reading functions etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I share @tonycoz's skepticism as to whether the addition of this header file is necessary or desirable.

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.

3 participants