Skip to content

Conversation

@knowledgecode
Copy link
Owner

Summary

  • Add waitLeave() method: waits for critical section release without locking it
  • Add isLocked() method: checks if object is currently locked
  • Refactor internal implementation with improved code structure
  • Add comprehensive test coverage for new methods
  • Update documentation with new API references and usage examples

Changes

Core Implementation

  • Add waitLeave(obj, timeout): waits for release without acquiring lock
  • Add isLocked(obj): non-destructive lock status check
  • Rename Occupation interface to Locking for clarity
  • Rename _occupy() to _lock() for consistency
  • Extract _wait() method to reduce code duplication
  • Update all type guards from isOccupation to isLocking

Testing

  • Add 5 test cases for waitLeave() covering timeout, non-locking behavior
  • Add 4 test cases for isLocked() covering various lock states
  • Update terminology from "unoccupied" to "unlocked" in test comments

Documentation

  • Add API documentation for waitLeave() and isLocked()
  • Add "Monitoring Resource Availability" usage pattern section
  • Update method count from 3 to 5 in Key Features
  • Update terminology from "occupied" to "locked" throughout

Test plan

  • All existing tests pass
  • New tests cover waitLeave() behavior (immediate return, waiting, timeout)
  • New tests cover isLocked() behavior (locked/unlocked states, independence)
  • Documentation examples are accurate and clear

- Add waitLeave() method: waits for critical section release without locking
- Add isLocked() method: checks if object is currently locked
- Rename interface Occupation to Locking for clarity
- Rename _occupy() to _lock() for consistency
- Extract _wait() method to reduce code duplication
- Update all internal type guards and references
- Add waitLeave() test suite with 5 test cases
- Add isLocked() test suite with 4 test cases
- Update terminology from "unoccupied" to "unlocked" in comments
- Verify waitLeave does not lock after waiting
- Test timeout behavior for both new methods
- Document waitLeave() API with parameters and examples
- Document isLocked() API with parameters and examples
- Add "Monitoring Resource Availability" usage pattern section
- Update method count from 3 to 5 in Key Features
- Update terminology from "occupied" to "locked" throughout
@knowledgecode knowledgecode merged commit 01f5d85 into main Oct 1, 2025
2 checks passed
@knowledgecode knowledgecode deleted the develop branch October 1, 2025 00:53
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