Added a few methods for Signal and Engine

This commit is contained in:
Tristan B. Velloza Kildaire 2021-08-28 11:41:21 +02:00
parent 635bdf255e
commit 29afd37f38
3 changed files with 43 additions and 0 deletions

Binary file not shown.

View File

@ -28,6 +28,19 @@ public final class Engine
}
/**
* Event loop
*/
public void run()
{
while(true)
{
/* TODO: Implement me */
/* TODO: Add yield to stop mutex starvation on a single thread */
}
}
/**
* push(Event e)
*

View File

@ -13,10 +13,40 @@ alias EventHandler = void function(Event);
public class Signal
{
/* TypeIDs this signal handler associates with */
private ulong[] typeIDs;
/* Signal handler */
private EventHandler handler;
this(ulong[] typeIDs, EventHandler handler)
{
this.typeIDs = typeIDs;
this.handler = handler;
}
/**
* Returns true if this signal handles the given typeID
* false otherwise
*/
public bool handles(ulong typeID)
{
/* FIXME: Implement */
return true;
}
public void registerTypeID(ulong typeID)
{
}
public void deregisterTypeID(ulong typeID)
{
}
public EventHandler getHandler()
{
return handler;
}
}