Main Page   Modules   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

share.h File Reference

Kolib.share.* *. More...

#include <sys/mutex.h>

Go to the source code of this file.

Compounds

struct  kmonCondition
struct  kMsg
 structure of a message in a MessageQueue. More...

struct  kQueue
 Message Queue. More...

struct  kSemaphore
 kernel semaphore More...

struct  rwshare_class
struct  rwStatus

Defines

#define __QUEUE_EXTENSION__
#define ksemInit(cnt)   {count: cnt, waiters: NULL}

Typedefs

typedef kSemaphore kSemaphore
 kernel semaphore

typedef enum kmsgMode kmsgMode
 behavior of the system when writing in a full queue

typedef kQueue kQueue
 Message Queue.

typedef kSemaphore kMonitor
typedef kmonCondition kmonCondition

Enumerations

enum  kmsgMode { KMSG_LOCKWRITER, KMSG_DROPTAIL, KMSG_DROPNLOG }
 behavior of the system when writing in a full queue More...


Functions

void ksemWait (kSemaphore *s)
 Wait on a semaphore.

kStatus ksemTry (kSemaphore *s)
 Trying to get a semaphore.

void ksemSignal (kSemaphore *s)
 Releases a semaphore.

kSemaphoreksemNew (int count)
 builds a new kernel semaphore

void ksemKill (kSemaphore *me)
 destroys a semaphore

kQueuekmsgNew (int places, void *xbase, int size)
 creates a new message queue with a given amount of slots.

void kmsgKill (kQueue *q)
void kmsgGet (kQueue *q, struct kMsg *target, void *xitem)
 extract a message out of a queue.

void kmsgPut (kQueue *q, struct kMsg *message, void *xitem)
 writes a message to a queue.


Detailed Description

Kolib.share.* *.


Define Documentation

#define __QUEUE_EXTENSION__
 

---------------------------------------------------------------** Components library to guarantee shared access at kernel level ** ---------------------------------------------------------------** Initial Release : 24.04.01 - by pype. ** last change : 2.09.02 - external datas in message queues **

#define ksemInit cnt       {count: cnt, waiters: NULL}
 


Typedef Documentation

typedef struct kmonCondition kmonCondition
 

typedef struct kSemaphore kMonitor
 

typedef enum kmsgMode kmsgMode
 

behavior of the system when writing in a full queue

typedef struct kQueue kQueue
 

Message Queue.

The message queue is managed as a circular buffer with two access pointers (one for reading out, the other for writing in). It is managed in a FIFO fashion, threads that attempt to read out of an empty queue or writing to a full queue are turned in wait state.

typedef struct kSemaphore kSemaphore
 

kernel semaphore


Enumeration Type Documentation

enum kmsgMode
 

behavior of the system when writing in a full queue

Enumeration values:
KMSG_LOCKWRITER  make the process sleep
KMSG_DROPTAIL  forget about the last message
KMSG_DROPNLOG  forget the last message and log a warning


Function Documentation

void kmsgGet kQueue   q,
struct kMsg   target,
void *    xitem
 

extract a message out of a queue.

the first available message of q is copied into target and its slot is freed in q. If no message is available, then the thread will sleep until a message arrives.

void kmsgKill kQueue   q
 

kQueue* kmsgNew int    places,
void *    xbase,
int    size
 

creates a new message queue with a given amount of slots.

void kmsgPut kQueue   q,
struct kMsg   message,
void *    xitem
 

writes a message to a queue.

The message content is copied into the queue. If no place is left, then we just wait for some place to be freed. optionnally, a queue extension can receive xitem at xbase[q]

void ksemKill kSemaphore   me
 

destroys a semaphore

If threads are still waiting, they should receive a SYSCALL_ABORT event (but well, events aren't already implemented :(

kSemaphore* ksemNew int    count
 

builds a new kernel semaphore

void ksemSignal kSemaphore   s
 

Releases a semaphore.

If any thread is waiting for the semaphore, the first of them is waken. If no thread is waiting, we just increment the semaphore count

kStatus ksemTry kSemaphore   s
 

Trying to get a semaphore.

If the semaphore reached 0, we don't sleep but rather return a FAIL.

void ksemWait kSemaphore   s
 

Wait on a semaphore.

If the semaphore counter is still above 0, we just decrement it. Otherwise, the thread is put on the sem's waitqueue and then we wait through a threadSuspend().


Generated on Mon Jul 14 17:00:31 2003 for Clicker32Kernel by doxygen1.2.18