MidiCountDTasks


Returns the number of time delayed tasks waiting in the list of an application. Delayed tasks are function calls that where scheduled with MidiDTask and that are now ready to be executed in the DTasksFifo of the application.

pascal long    MidiCountDTasks (short refNum);

refNum
a 16-bit integer, the reference number of the application.

The result is a 32-bit integer, the number of waiting DTasks.


Execute the waiting DTasks of a MidiShare application.


void ExecuteAllDTasks(short refNum)
{
    long    n;

    for (n=MidiCountDTasks(refNum), n>0; n--)
    {
        MidiExec1DTask(refNum);
    }
}

A typical application might execute the queued tasks from with in its 'main' loop, and since it is not under interruption, operating system calls may be performed. However this does mean that the execution time of these functions cannot be accurately predicted.