SemaphoreDemo: Added comments

This commit is contained in:
2025-03-19 20:00:56 +01:00
parent ab6ad3dcc7
commit 8c12a1a904

View File

@@ -29,6 +29,9 @@ class MyThread extends Thread
public MyThread(Semaphore mySemPro, Semaphore mySemCon, String threadName) public MyThread(Semaphore mySemPro, Semaphore mySemCon, String threadName)
{ {
// The Thread class constructor that takes a String argument creates
// a Thread with a specific name
// (as opposed to automatically generated names such as Thread-1).
super(threadName); super(threadName);
// We set the semaphores from the main method // We set the semaphores from the main method
this.semPro = mySemPro; this.semPro = mySemPro;