Skip to content

Document the public multiprocessing.[Bounded]Semaphore.get_value method and refactor code #133146

Open
@YvesDup

Description

@YvesDup

Feature or enhancement

Proposal:

This improvement is based on @ronaldoussoren's comment at #125829 (comment)

  1. This public method should be documented in the synchronization primitives of multiprocessing module.
  2. I also suggest to refactor code with this public method, in replacement of calls to the private method semaphore._semlock._get_value in the following locations:

value = self._semlock._get_value()

value = self._semlock._get_value()

num_waiters = (self._sleeping_count._semlock._get_value() -
self._woken_count._semlock._get_value())

return self._maxsize - self._sem._semlock._get_value()

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Links to previous discussion of this feature:

No response

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions