Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
T
ThreadsSyncronization
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sahar.moalla
ThreadsSyncronization
Commits
cfd3e0fb
Commit
cfd3e0fb
authored
Nov 29, 2023
by
sahar.moalla
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ThreadSync
parent
22286ac1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
3 additions
and
3 deletions
+3
-3
.gitkeep
ThreadPoolProject/.gitkeep
+0
-0
SynchronizedQueue.java
ThreadPoolProject/src/main/java/SynchronizedQueue.java
+1
-1
ThreadPoolMain.java
ThreadPoolProject/src/main/java/ThreadPoolMain.java
+2
-2
No files found.
ThreadPoolProject/.gitkeep
deleted
100644 → 0
View file @
22286ac1
ThreadPoolProject/src/main/java/SynchronizedQueue.java
View file @
cfd3e0fb
...
...
@@ -37,7 +37,7 @@ public class SynchronizedQueue<T> {
while
(
queue
.
isEmpty
())
{
wait
();
}
notifyAll
();
// Remove and return the element from the queue
return
queue
.
poll
();
}
...
...
ThreadPoolProject/src/main/java/ThreadPoolMain.java
View file @
cfd3e0fb
...
...
@@ -3,10 +3,10 @@ public class ThreadPoolMain {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
// Create a thread pool with 3 threads and a maximum of 10 tasks
ThreadPool
threadPool
=
new
ThreadPool
(
3
,
10
);
ThreadPool
threadPool
=
new
ThreadPool
(
3
,
10
0
);
// Execute 10 tasks
for
(
int
i
=
0
;
i
<
10
;
i
++)
{
for
(
int
i
=
0
;
i
<
10
00
;
i
++)
{
int
taskNo
=
i
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment