mirror of https://github.com/deavmi/tasky.git
Future: Added addClass(ulong) to add a custom descriptor ID
This commit is contained in:
parent
2251a00284
commit
89347cb6d2
|
@ -242,10 +242,12 @@ public abstract class Descriptor : Signal
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Descriptor
|
* Creates a new Descriptor
|
||||||
|
*
|
||||||
|
* FIXME: What if we cannot get a valid ID? Throw an exception
|
||||||
*/
|
*/
|
||||||
this()
|
this()
|
||||||
{
|
{
|
||||||
/* Grab a descripor ID */
|
/* Grab a descriptor ID */
|
||||||
descriptorClass = addDescQueue();
|
descriptorClass = addDescQueue();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -256,6 +258,39 @@ public abstract class Descriptor : Signal
|
||||||
super([descriptorClass]);
|
super([descriptorClass]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Given a descriptor class this will attempt adding it,
|
||||||
|
* on failure false is returned, on sucess, true
|
||||||
|
*
|
||||||
|
* NOTE: New feature, not yet in use
|
||||||
|
*/
|
||||||
|
private bool addClass(ulong descriptorClass)
|
||||||
|
{
|
||||||
|
bool status;
|
||||||
|
|
||||||
|
descQueueLock.lock();
|
||||||
|
|
||||||
|
/* Check if we can add it */
|
||||||
|
if(!isDescIDInUse(descriptorClass))
|
||||||
|
{
|
||||||
|
/* Add it to the ID queue */
|
||||||
|
descQueue ~= descriptorClass;
|
||||||
|
|
||||||
|
/* Set status to successful */
|
||||||
|
status = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* Set status to failure */
|
||||||
|
status = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
descQueueLock.unlock();
|
||||||
|
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Descriptor (with a given fixed descriptor class)
|
* Creates a new Descriptor (with a given fixed descriptor class)
|
||||||
*
|
*
|
||||||
|
@ -263,7 +298,11 @@ public abstract class Descriptor : Signal
|
||||||
*/
|
*/
|
||||||
this(ulong descriptorClass)
|
this(ulong descriptorClass)
|
||||||
{
|
{
|
||||||
/* TODO: Check if it is available */
|
/* Check if the given descriptor class is available */
|
||||||
|
if(isDescIDInUse(descriptorClass))
|
||||||
|
{
|
||||||
|
/* TODO: This is a bad idea, we need to lock and one shot this */
|
||||||
|
}
|
||||||
/* TODO: Add to queue */
|
/* TODO: Add to queue */
|
||||||
|
|
||||||
/* Set the descriptor ID */
|
/* Set the descriptor ID */
|
||||||
|
|
Loading…
Reference in New Issue