Ejemplo n.º 1
0
void pingUpdateTask(void)
{
    static Node *thisNode, *nextNode;
    static ping *thisPing;

    taskYield(0);
    while (1)
    {
        taskStackSaveCond(0);

        thisNode = pingList.head;

        //... code to go here...

        while (thisNode != NULL)
        {                                                   //scan all pings
            nextNode = thisNode->next;
            thisPing = listGetStructOfNode(thisNode);
            if (universe.totaltimeelapsed - thisPing->lastEvaluateTime >= thisPing->evaluatePeriod)
            {                                               //if time to evaluate a ping
                thisPing->lastEvaluateTime = universe.totaltimeelapsed;
                if (thisPing->evaluate(thisPing, thisPing->userID, (char *)(thisPing + 1), FALSE))
                {                                           //did this ping just expire?
                    listDeleteNode(thisNode);               //kill it if so
                }
            }

            thisNode = nextNode;
        }
        taskStackRestoreCond();
        taskYield(0);
    }
}
Ejemplo n.º 2
0
Archivo: eg.c Proyecto: AnyBees/PAF-RUN
void task7()
{
        int i;
        while(1)
        {
                for ( i = 0; i < 5; ++ i )
                {
                        printf( " I'm task #7: %d\n", i );
                }
                taskYield();
        }
}
Ejemplo n.º 3
0
Archivo: eg.c Proyecto: AnyBees/PAF-RUN
/* function execucted by task0 */
void task0()
{
	int i;
	/* infinite loop: each iteration is one job instance */
	while(1)
	{
		for ( i = 0; i < 5; ++ i )
		{	
			printf( "I'm task #0: %d\n", i );
		}
		/* job is done. Call scheduler */
		taskYield();
	}
}