- Make `running` private and only read-accessile via `isRunning()` method which is available at the package level
- Added todo for `engine` field

Receiver

- Use `isRunning()` now

Sender

- Use `isRunning()` now
This commit is contained in:
Tristan B. Velloza Kildaire 2023-06-29 21:22:46 +02:00
parent 7cfed69036
commit f84b019416
3 changed files with 18 additions and 3 deletions

View File

@ -63,11 +63,26 @@ public class Client : Thread
/**
* Eventy event engine
*
* (TODO: Try make private)
*/
package Engine engine;
package bool running = false;
/**
* Whether the client is running or not
*/
private bool running = false;
/**
* Checks whether this client is running
*
* Returns: `true` if running, `false`
* otherwise
*/
package bool isRunning()
{
return this.running;
}
/**
* Constructs a new IRC client with the given configuration

View File

@ -110,7 +110,7 @@ public final class ReceiverThread : Thread
*/
private void recvHandlerFunc()
{
while(client.running)
while(client.isRunning())
{
// TODO: We could look at libsnooze wait starvation or mutex racing (future thought)

View File

@ -95,7 +95,7 @@ public final class SenderThread : Thread
*/
private void sendHandlerFunc()
{
while(client.running)
while(client.isRunning())
{
// TODO: We could look at libsnooze wait starvation or mutex racing (future thought)