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

rwshare.c File Reference

#include <sys/global.h>
#include <sys/thread.h>
#include <koLib/share.h>
#include <koLib/monitor.h>
#include <slang.h>

Functions

void readEpilog (struct rwStatus *rws)
 release access to shared object (we had a read lock)

kStatus ksemResume (kSemaphore *s, kThread *t)
 Removes a thread from the semaphore waitqueue.

kStatus rwReadResume (struct rwStatus *rws, struct kThread *th)
 what should we do if an waiting reader is killed ?

kStatus rwActiveReaderResume (struct rwStatus *rws, struct kThread *th)
 what should we do if an active reader is killed ?

kStatus rwWriteResume (struct rwStatus *rws, struct kThread *th)
 What should be do if a waiting writer is killed ?

void readProlog (struct rwStatus *rws)
 Get read access to the shared object.

void writeProlog (struct rwStatus *rws)
 get a write lock on a shared object

void writeEpilog (struct rwStatus *rws)
 release the write lock we got

void rwsInit (struct rwStatus *rws)
 initializes the access sharing of an object


Variables

rwshare_class rwclass

Function Documentation

kStatus ksemResume kSemaphore   s,
kThread   t
 

Removes a thread from the semaphore waitqueue.

void readEpilog struct rwStatus   rws
 

release access to shared object (we had a read lock)

void readProlog struct rwStatus   rws
 

Get read access to the shared object.

kStatus rwActiveReaderResume struct rwStatus   rws,
struct kThread   th
 

what should we do if an active reader is killed ?

same problem if the thread has entered the read mode. see rwReadResume comments for enlightenments.

kStatus rwReadResume struct rwStatus   rws,
struct kThread   th
 

what should we do if an waiting reader is killed ?

If we want the reader thread to be killable, then we should put this function as the "resume method" for the thread". Another possible way doing things is to declare the thread as "shielded" during the read (kill will be deferred)

void rwsInit struct rwStatus   rws
 

initializes the access sharing of an object

note that we can't use "log" here because LOG uses reader/writers to performs its inline kdsInvoque :) Also note that you shouldn't use an uninitialised sharer !!

kStatus rwWriteResume struct rwStatus   rws,
struct kThread   th
 

What should be do if a waiting writer is killed ?

void writeEpilog struct rwStatus   rws
 

release the write lock we got

void writeProlog struct rwStatus   rws
 

get a write lock on a shared object


Variable Documentation

struct rwshare_class rwclass
 

Initial value:

{
       readProlog,readEpilog,writeProlog,writeEpilog,rwsInit
}


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