Skip to content

Add simple thread-safe queue implementation#7390

Open
prashantpiyush1111 wants to merge 17 commits intoTheAlgorithms:masterfrom
prashantpiyush1111:feature/thread-safe-queue
Open

Add simple thread-safe queue implementation#7390
prashantpiyush1111 wants to merge 17 commits intoTheAlgorithms:masterfrom
prashantpiyush1111:feature/thread-safe-queue

Conversation

@prashantpiyush1111
Copy link
Copy Markdown
Contributor

This PR adds a simple thread-safe queue implementation using Java synchronization.

Features:

  • Node-based linked list implementation
  • Thread-safe enqueue and dequeue using synchronized methods
  • Basic operations: enqueue, dequeue, and isEmpty
  • Simple and educational design

Motivation:

This implementation helps demonstrate:

  • Mutual exclusion using synchronized
  • Avoidance of race conditions
  • Behavior of data structures in a multithreaded environment

A simple test example is also included to show multithreaded usage.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.58%. Comparing base (b3e31b5) to head (3293397).

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #7390      +/-   ##
============================================
+ Coverage     79.53%   79.58%   +0.04%     
- Complexity     7176     7195      +19     
============================================
  Files           798      800       +2     
  Lines         23467    23504      +37     
  Branches       4617     4619       +2     
============================================
+ Hits          18665    18706      +41     
+ Misses         4055     4054       -1     
+ Partials        747      744       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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