coop.c File Reference

Simple cooperative multitasking scheduler. More...

#include "proc_p.h"
#include "proc.h"
#include <cfg/log.h>
#include <cpu/irq.h>
#include <cpu/types.h>
#include <cpu/attr.h>
#include <cpu/frame.h>

Go to the source code of this file.


Functions

EXTERN_C void asm_switch_context (cpu_stack_t **new_sp, cpu_stack_t **save_sp)
 CPU dependent context switching routines.
static void proc_schedule (void)
 System scheduler: pass CPU control to the next process in the ready queue.
void proc_switch (void)
 Schedule another process *without* adding the current one to the ready list.
void proc_yield (void)
 Co-operative context switch.

Detailed Description

Simple cooperative multitasking scheduler.

Version:
Id
coop.c 2506 2009-04-15 08:29:07Z duplo
Author:
Bernie Innocenti <bernie@codewiz.org>

Stefano Fedrigo <aleph@develer.com>

Definition in file coop.c.


Function Documentation

EXTERN_C void asm_switch_context ( cpu_stack_t **  new_sp,
cpu_stack_t **  save_sp 
)

CPU dependent context switching routines.

Saving and restoring the context on the stack is done by a CPU-dependent support routine which usually needs to be written in assembly.

void proc_yield ( void   ) 

Co-operative context switch.

The process that calls this function will release the CPU before its cpu quantum expires, the scheduler will run to select the next process that will take control of the processor.

Note:
This function is available only if CONFIG_KERN is enabled
See also:
cpu_relax(), which is the recommended method to release the cpu.

Definition at line 139 of file coop.c.