* cleanup of rtlevents, remove startwait due to persistance guarantee

git-svn-id: trunk@5854 -
This commit is contained in:
micha 2007-01-08 19:11:07 +00:00
parent 2244f1b9c6
commit 702685717f
5 changed files with 11 additions and 49 deletions

View File

@ -252,12 +252,6 @@ begin
currenttm.rtleventResetEvent(state);
end;
procedure RTLeventStartWait(state:pRTLEvent);
begin
currenttm.rtleventStartWait(state);
end;
procedure RTLeventWaitFor(state:pRTLEvent);
begin
@ -436,12 +430,6 @@ begin
NoThreadError;
end;
procedure NORTLeventStartWait(state:pRTLEvent);
begin
NoThreadError;
end;
procedure NORTLeventWaitFor(state:pRTLEvent);
begin
NoThreadError;
@ -515,7 +503,6 @@ begin
rtlEventCreate :=@NortlEventCreate;
rtleventdestroy :=@Nortleventdestroy;
rtleventSetEvent :=@NortleventSetEvent;
rtleventStartWait :=@NortleventStartWait;
rtleventWaitFor :=@NortleventWaitFor;
rtleventsync :=@Nortleventsync;
rtleventwaitfortimeout :=@NortleventWaitForTimeout;

View File

@ -83,7 +83,6 @@ type
RTLEventDestroy : TRTLEventHandler;
RTLEventSetEvent : TRTLEventHandler;
RTLEventResetEvent : TRTLEventHandler;
RTLEventStartWait : TRTLEventHandler;
RTLEventWaitFor : TRTLEventHandler;
RTLEventSync : TRTLEventSyncHandler;
RTLEventWaitForTimeout : TRTLEventHandlerTimeout;
@ -158,7 +157,6 @@ function RTLEventCreate :PRTLEvent;
procedure RTLeventdestroy(state:pRTLEvent);
procedure RTLeventSetEvent(state:pRTLEvent);
procedure RTLeventResetEvent(state:pRTLEvent);
procedure RTLeventStartWait(state:pRTLEvent);
procedure RTLeventWaitFor(state:pRTLEvent);
procedure RTLeventWaitFor(state:pRTLEvent;timeout : longint);
procedure RTLeventsync(m:trtlmethod;p:tprocedure);

View File

@ -467,19 +467,13 @@ procedure IntRTLEventSetEvent (AEvent: PRTLEvent);
begin
{$WARNING TODO!}
{
PulseEvent(THANDLE(AEvent));
SetEvent(THANDLE(AEvent));
}
end;
CONST INFINITE=-1;
procedure IntRTLEventStartWait (AEvent: PRTLEvent);
begin
{$WARNING TODO!}
// nothing to do, win32 events stay signalled after being set
end;
procedure IntRTLEventWaitFor (AEvent: PRTLEvent);
begin
{$WARNING TODO!}
@ -526,7 +520,6 @@ begin
RTLEventCreate :=@IntRTLEventCreate;
RTLEventDestroy :=@IntRTLEventDestroy;
RTLEventSetEvent :=@IntRTLEventSetEvent;
RTLEventStartWait :=@IntRTLEventStartWait;
RTLEventWaitFor :=@IntRTLEventWaitFor;
end;
SetThreadManager (OS2ThreadManager);

View File

@ -71,7 +71,7 @@ Type PINTRTLEvent = ^TINTRTLEvent;
TINTRTLEvent = record
condvar: pthread_cond_t;
mutex: pthread_mutex_t;
IsSet: boolean;
isset: boolean;
end;
{*****************************************************************************
@ -738,7 +738,7 @@ begin
new(p);
pthread_cond_init(@p^.condvar, nil);
pthread_mutex_init(@p^.mutex, nil);
p^.IsSet:= false;
p^.isset:=false;
result:=PRTLEVENT(p);
end;
@ -759,7 +759,7 @@ var p:pintrtlevent;
begin
p:=pintrtlevent(aevent);
pthread_mutex_lock(@p^.mutex);
p^.IsSet:= true;
p^.isset:=true;
pthread_cond_signal(@p^.condvar);
pthread_mutex_unlock(@p^.mutex);
end;
@ -771,26 +771,19 @@ var p:pintrtlevent;
begin
p:=pintrtlevent(aevent);
pthread_mutex_lock(@p^.mutex);
p^.IsSet:= false;
p^.isset:=false;
pthread_mutex_unlock(@p^.mutex);
end;
procedure intRTLEventStartWait(AEvent: PRTLEvent);
var p:pintrtlevent;
begin
p:=pintrtlevent(aevent);
pthread_mutex_lock(@p^.mutex);
end;
procedure intRTLEventWaitFor(AEvent: PRTLEvent);
var p:pintrtlevent;
begin
p:=pintrtlevent(aevent);
while not p^.IsSet do pthread_cond_wait(@p^.condvar, @p^.mutex);
p^.IsSet:=false;
pthread_mutex_lock(@p^.mutex);
while not p^.isset do pthread_cond_wait(@p^.condvar, @p^.mutex);
p^.isset:=false;
pthread_mutex_unlock(@p^.mutex);
end;
@ -812,12 +805,13 @@ procedure intRTLEventWaitForTimeout(AEvent: PRTLEvent;timeout : longint);
dec(timespec.tv_nsec, 1000000000);
end;
errres:=0;
while (not p^.IsSet) and
pthread_mutex_lock(@p^.mutex);
while (not p^.isset) and
(errres <> ESysETIMEDOUT) do
begin
errres:=pthread_cond_timedwait(@p^.condvar, @p^.mutex, @timespec);
end;
p^.IsSet:= false;
p^.isset:=false;
pthread_mutex_unlock(@p^.mutex);
end;
@ -890,7 +884,6 @@ begin
rtlEventDestroy :=@intrtlEventDestroy;
rtlEventSetEvent :=@intrtlEventSetEvent;
rtlEventResetEvent :=@intrtlEventResetEvent;
rtlEventStartWait :=@intrtlEventStartWait;
rtleventWaitForTimeout :=@intrtleventWaitForTimeout;
rtleventWaitFor :=@intrtleventWaitFor;
// semaphores

View File

@ -414,14 +414,6 @@ begin
ResetEvent(THANDLE(AEvent));
end;
procedure intRTLEventStartWait(AEvent: PRTLEvent);
begin
{ this is to get at least some common behaviour on unix and win32:
events before startwait are lost on unix, so reset the event on
win32 as well }
ResetEvent(THANDLE(AEvent));
end;
procedure intRTLEventWaitFor(AEvent: PRTLEvent);
const
INFINITE=dword(-1);
@ -471,7 +463,6 @@ begin
RTLEventDestroy :=@intRTLEventDestroy;
RTLEventSetEvent :=@intRTLEventSetEvent;
RTLEventResetEvent :=@intRTLEventResetEvent;
RTLEventStartWait :=@intRTLEventStartWait;
RTLEventWaitFor :=@intRTLEventWaitFor;
RTLEventWaitForTimeout :=@intRTLEventWaitForTimeout;
end;