Hello..
My inventions that are my SemaMonitor and my SemaCondvar were updated to version 2.3, they have become efficient and powerful, please read the
readme file to know more about the changes, and i have implemented an
efficient Monitor over my SemaCondvar. Here is the description of my
efficient Monitor inside the Monitor.pas file that you will find inside
the zip file:
Description:
This is my implementation of a Monitor over my SemaCondvar.
You will find the Monitor class inside the Monitor.pas file inside the
zip file.
When you set the first parameter of the constructor to true, the signal
will not be lost if the threads are not waiting with wait() method, but
when you set the first parameter of the construtor to false, if the
threads are not waiting with the wait() method, the signal will be lost..
Second parameter of the constructor is the kind of Lock, you can
set it to ctMLock to use my scalable node based lock called MLock, or
you can set it to ctMutex to use a Mutex or you can set it to
ctCriticalSection to use the TCriticalSection.
Here is the methods of my efficient Monitor that i have implemented:
TMonitor = class
private
cache0:typecache0;
lock1:TSyncLock;
obj:TSemaCondvar;
cache1:typecache0;
public
constructor Create(bool:boolean=true;lock:TMyLocks=ctMLock);
destructor Destroy; override;
procedure Enter();
procedure Leave();
function Signal():boolean;overload;
function Signal(nbr:long;var remains:long):boolean;overload;
procedure Signal_All();
function Wait(const AMilliseconds:longword=INFINITE): boolean;
function WaitersBlocked():long;
end;
The wait() method is for the threads to wait on the Monitor object for
the signal to be signaled. If wait() fails, that can be that the number
of waiters is greater than high(longword).
And the signal() method will signal one time a waiting thread on the
Monitor object, but if signal() fails , the returned value is false.
the signal_all() method will signal all the waiting threads on the
Monitor object.
The signal(nbr:long;var remains:long) method will signal nbr of waiting threads, but if signal() fails, the remaining number of signals that
were not signaled will be returned in the remains variable.
and WaitersBlocked() will return the number of waiting threads on the
Monitor object.
and Enter() and Leave() methods to enter and leave the monitor's Lock.
You can download the zip files from:
https://sites.google.com/site/scalable68/semacondvar-semamonitor
and the lightweight version is here:
https://sites.google.com/site/scalable68/light-weight-semacondvar-semamonitor
Thank you,
Amine Moulay Ramdane.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)