Add simple thread-safe queue implementation by prashantpiyush1111 · Pull Request #7390 · TheAlgorithms/Java · GitHub
Skip to content

Add simple thread-safe queue implementation#7390

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

Add simple thread-safe queue implementation#7390
prashantpiyush1111 wants to merge 18 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

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