Main Page | Data Structures | File List | Data Fields | Globals
Equipment Financing SBA Loans Big Lines of Credit Merchant Cash Advances Long Term Loans Working Capital best business loans Small Business Loansbusiness loans Short Term Loads

opale_task.c

Go to the documentation of this file.
00001 // C Source File 00002 // Created 05/02/05; 00:42:03 00003 00004 #include "opale_internal.h" 00005 00017 short op_TaskStart( register t_TASK* task asm("£"), register void(*taskEntryFunction)( register void* asm(" ") ) asm("¢"), register char* stackPointer asm("¡"), register unsigned char ident asm("Ð"), register void* taskFunctionArgs asm(" ") ) 00018 { 00019 00020 if( runningTasks[ ident ] != NULL ) return FALSE; 00021 00022 /* inits the fields of the task's structure */ 00023 task->ident = ident; 00024 task->prevSleeping = NULL; 00025 task->nextSleeping = NULL; 00026 00027 /* inits the task's stack */ 00028 task->stackPointer = InitStack( taskFunctionArgs, stackPointer, taskEntryFunction ); 00029 00030 /* add the task to the list of tasks */ 00031 op_EnterCriticalSection(); 00032 00033 runningTasks[ ident ] = task; 00034 addTaskToTable( readyTasks, ident ); 00035 00036 op_ExitCriticalSection(); 00037 00038 op_Scheduler(); 00039 00040 return TRUE; 00041 } 00042 00046 void op_TaskStop( void ) 00047 { 00048 unsigned char ident = currentTask->ident; 00049 00050 op_EnterCriticalSection(); 00051 00052 runningTasks[ ident ] = NULL; 00053 removeTaskFromTable( readyTasks, ident ); 00054 00055 op_ExitCriticalSection(); 00056 op_Scheduler(); 00057 00058 } 00059 00064 void op_TaskWaitForTicks( register unsigned short ticks asm("Ð") ) 00065 { 00066 00067 currentTask->tickDelay = ticks; 00068 00069 op_EnterCriticalSection(); 00070 00071 currentTask->prevSleeping = &idleTask; 00072 00073 if( (currentTask->nextSleeping = idleTask.nextSleeping) ) 00074 (idleTask.nextSleeping)->prevSleeping = currentTask; 00075 00076 idleTask.nextSleeping = currentTask; 00077 00078 removeTaskFromTable( readyTasks, currentTask->ident ); 00079 00080 op_ExitCriticalSection(); 00081 00082 op_Scheduler(); 00083 00084 } 00085 00086 /* end of file */

Generated on Sun May 14 22:31:06 2006 for Opale by doxygen 1.3.8