Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

* Context Switching
[Emulator (UNIX)System Support]

Collaboration diagram for * Context Switching:


Detailed Description

Context Switching for the UNIX emulator.


Functions

void NutThreadInit ()
void NutThreadSwitch (void)
 Switch to another thread.
HANDLE NutThreadCreate (char *name, void(*fn)(void *), void *arg, size_t stackSize)
 Create a new thread.

Variables

*pthread_attr_t attr
pthread_mutex_t thread_mutex
pthread_cond_t main_cv
u_short main_cs_level


Function Documentation

void NutThreadSwitch void   ) 
 

Switch to another thread.

Stop the current thread, saving its context. Then start the one with the highest priority, which is ready to run.

Application programs typically do not call this function.

Note:
CPU interrupts must be disabled before calling this function.

HANDLE NutThreadCreate char *  name,
void(*)(void *)  fn,
void *  arg,
size_t  stackSize
 

Create a new thread.

If the current thread's priority is lower or equal than the default priority (64), then the current thread is stopped and the new one is started.

Parameters:
name String containing the symbolic name of the new thread, up to 8 characters long.
fn The thread's entry point, typically created by the THREAD macro.
arg Argument pointer passed to the new thread.
stackSize Number of bytes of the stack space allocated for the new thread.
Returns:
Pointer to the NUTTHREADINFO structure or 0 to indicate an error.


© 2000-2006 by egnite Software GmbH - visit http://www.ethernut.de/