mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-31 17:30:38 +02:00
* cleanup of rtlevents, remove startwait due to persistance guarantee
git-svn-id: trunk@5854 -
This commit is contained in:
parent
2244f1b9c6
commit
702685717f
@ -252,12 +252,6 @@ begin
|
|||||||
currenttm.rtleventResetEvent(state);
|
currenttm.rtleventResetEvent(state);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure RTLeventStartWait(state:pRTLEvent);
|
|
||||||
|
|
||||||
begin
|
|
||||||
currenttm.rtleventStartWait(state);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure RTLeventWaitFor(state:pRTLEvent);
|
procedure RTLeventWaitFor(state:pRTLEvent);
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -436,12 +430,6 @@ begin
|
|||||||
NoThreadError;
|
NoThreadError;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure NORTLeventStartWait(state:pRTLEvent);
|
|
||||||
begin
|
|
||||||
NoThreadError;
|
|
||||||
end;
|
|
||||||
|
|
||||||
|
|
||||||
procedure NORTLeventWaitFor(state:pRTLEvent);
|
procedure NORTLeventWaitFor(state:pRTLEvent);
|
||||||
begin
|
begin
|
||||||
NoThreadError;
|
NoThreadError;
|
||||||
@ -515,7 +503,6 @@ begin
|
|||||||
rtlEventCreate :=@NortlEventCreate;
|
rtlEventCreate :=@NortlEventCreate;
|
||||||
rtleventdestroy :=@Nortleventdestroy;
|
rtleventdestroy :=@Nortleventdestroy;
|
||||||
rtleventSetEvent :=@NortleventSetEvent;
|
rtleventSetEvent :=@NortleventSetEvent;
|
||||||
rtleventStartWait :=@NortleventStartWait;
|
|
||||||
rtleventWaitFor :=@NortleventWaitFor;
|
rtleventWaitFor :=@NortleventWaitFor;
|
||||||
rtleventsync :=@Nortleventsync;
|
rtleventsync :=@Nortleventsync;
|
||||||
rtleventwaitfortimeout :=@NortleventWaitForTimeout;
|
rtleventwaitfortimeout :=@NortleventWaitForTimeout;
|
||||||
|
@ -83,7 +83,6 @@ type
|
|||||||
RTLEventDestroy : TRTLEventHandler;
|
RTLEventDestroy : TRTLEventHandler;
|
||||||
RTLEventSetEvent : TRTLEventHandler;
|
RTLEventSetEvent : TRTLEventHandler;
|
||||||
RTLEventResetEvent : TRTLEventHandler;
|
RTLEventResetEvent : TRTLEventHandler;
|
||||||
RTLEventStartWait : TRTLEventHandler;
|
|
||||||
RTLEventWaitFor : TRTLEventHandler;
|
RTLEventWaitFor : TRTLEventHandler;
|
||||||
RTLEventSync : TRTLEventSyncHandler;
|
RTLEventSync : TRTLEventSyncHandler;
|
||||||
RTLEventWaitForTimeout : TRTLEventHandlerTimeout;
|
RTLEventWaitForTimeout : TRTLEventHandlerTimeout;
|
||||||
@ -158,7 +157,6 @@ function RTLEventCreate :PRTLEvent;
|
|||||||
procedure RTLeventdestroy(state:pRTLEvent);
|
procedure RTLeventdestroy(state:pRTLEvent);
|
||||||
procedure RTLeventSetEvent(state:pRTLEvent);
|
procedure RTLeventSetEvent(state:pRTLEvent);
|
||||||
procedure RTLeventResetEvent(state:pRTLEvent);
|
procedure RTLeventResetEvent(state:pRTLEvent);
|
||||||
procedure RTLeventStartWait(state:pRTLEvent);
|
|
||||||
procedure RTLeventWaitFor(state:pRTLEvent);
|
procedure RTLeventWaitFor(state:pRTLEvent);
|
||||||
procedure RTLeventWaitFor(state:pRTLEvent;timeout : longint);
|
procedure RTLeventWaitFor(state:pRTLEvent;timeout : longint);
|
||||||
procedure RTLeventsync(m:trtlmethod;p:tprocedure);
|
procedure RTLeventsync(m:trtlmethod;p:tprocedure);
|
||||||
|
@ -467,19 +467,13 @@ procedure IntRTLEventSetEvent (AEvent: PRTLEvent);
|
|||||||
begin
|
begin
|
||||||
{$WARNING TODO!}
|
{$WARNING TODO!}
|
||||||
{
|
{
|
||||||
PulseEvent(THANDLE(AEvent));
|
SetEvent(THANDLE(AEvent));
|
||||||
}
|
}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
CONST INFINITE=-1;
|
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);
|
procedure IntRTLEventWaitFor (AEvent: PRTLEvent);
|
||||||
begin
|
begin
|
||||||
{$WARNING TODO!}
|
{$WARNING TODO!}
|
||||||
@ -526,7 +520,6 @@ begin
|
|||||||
RTLEventCreate :=@IntRTLEventCreate;
|
RTLEventCreate :=@IntRTLEventCreate;
|
||||||
RTLEventDestroy :=@IntRTLEventDestroy;
|
RTLEventDestroy :=@IntRTLEventDestroy;
|
||||||
RTLEventSetEvent :=@IntRTLEventSetEvent;
|
RTLEventSetEvent :=@IntRTLEventSetEvent;
|
||||||
RTLEventStartWait :=@IntRTLEventStartWait;
|
|
||||||
RTLEventWaitFor :=@IntRTLEventWaitFor;
|
RTLEventWaitFor :=@IntRTLEventWaitFor;
|
||||||
end;
|
end;
|
||||||
SetThreadManager (OS2ThreadManager);
|
SetThreadManager (OS2ThreadManager);
|
||||||
|
@ -71,7 +71,7 @@ Type PINTRTLEvent = ^TINTRTLEvent;
|
|||||||
TINTRTLEvent = record
|
TINTRTLEvent = record
|
||||||
condvar: pthread_cond_t;
|
condvar: pthread_cond_t;
|
||||||
mutex: pthread_mutex_t;
|
mutex: pthread_mutex_t;
|
||||||
IsSet: boolean;
|
isset: boolean;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{*****************************************************************************
|
{*****************************************************************************
|
||||||
@ -738,7 +738,7 @@ begin
|
|||||||
new(p);
|
new(p);
|
||||||
pthread_cond_init(@p^.condvar, nil);
|
pthread_cond_init(@p^.condvar, nil);
|
||||||
pthread_mutex_init(@p^.mutex, nil);
|
pthread_mutex_init(@p^.mutex, nil);
|
||||||
p^.IsSet:= false;
|
p^.isset:=false;
|
||||||
result:=PRTLEVENT(p);
|
result:=PRTLEVENT(p);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -759,7 +759,7 @@ var p:pintrtlevent;
|
|||||||
begin
|
begin
|
||||||
p:=pintrtlevent(aevent);
|
p:=pintrtlevent(aevent);
|
||||||
pthread_mutex_lock(@p^.mutex);
|
pthread_mutex_lock(@p^.mutex);
|
||||||
p^.IsSet:= true;
|
p^.isset:=true;
|
||||||
pthread_cond_signal(@p^.condvar);
|
pthread_cond_signal(@p^.condvar);
|
||||||
pthread_mutex_unlock(@p^.mutex);
|
pthread_mutex_unlock(@p^.mutex);
|
||||||
end;
|
end;
|
||||||
@ -771,26 +771,19 @@ var p:pintrtlevent;
|
|||||||
begin
|
begin
|
||||||
p:=pintrtlevent(aevent);
|
p:=pintrtlevent(aevent);
|
||||||
pthread_mutex_lock(@p^.mutex);
|
pthread_mutex_lock(@p^.mutex);
|
||||||
p^.IsSet:= false;
|
p^.isset:=false;
|
||||||
pthread_mutex_unlock(@p^.mutex);
|
pthread_mutex_unlock(@p^.mutex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure intRTLEventStartWait(AEvent: PRTLEvent);
|
|
||||||
var p:pintrtlevent;
|
|
||||||
|
|
||||||
begin
|
|
||||||
p:=pintrtlevent(aevent);
|
|
||||||
pthread_mutex_lock(@p^.mutex);
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure intRTLEventWaitFor(AEvent: PRTLEvent);
|
procedure intRTLEventWaitFor(AEvent: PRTLEvent);
|
||||||
var p:pintrtlevent;
|
var p:pintrtlevent;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
p:=pintrtlevent(aevent);
|
p:=pintrtlevent(aevent);
|
||||||
while not p^.IsSet do pthread_cond_wait(@p^.condvar, @p^.mutex);
|
pthread_mutex_lock(@p^.mutex);
|
||||||
p^.IsSet:=false;
|
while not p^.isset do pthread_cond_wait(@p^.condvar, @p^.mutex);
|
||||||
|
p^.isset:=false;
|
||||||
pthread_mutex_unlock(@p^.mutex);
|
pthread_mutex_unlock(@p^.mutex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -812,12 +805,13 @@ procedure intRTLEventWaitForTimeout(AEvent: PRTLEvent;timeout : longint);
|
|||||||
dec(timespec.tv_nsec, 1000000000);
|
dec(timespec.tv_nsec, 1000000000);
|
||||||
end;
|
end;
|
||||||
errres:=0;
|
errres:=0;
|
||||||
while (not p^.IsSet) and
|
pthread_mutex_lock(@p^.mutex);
|
||||||
|
while (not p^.isset) and
|
||||||
(errres <> ESysETIMEDOUT) do
|
(errres <> ESysETIMEDOUT) do
|
||||||
begin
|
begin
|
||||||
errres:=pthread_cond_timedwait(@p^.condvar, @p^.mutex, @timespec);
|
errres:=pthread_cond_timedwait(@p^.condvar, @p^.mutex, @timespec);
|
||||||
end;
|
end;
|
||||||
p^.IsSet:= false;
|
p^.isset:=false;
|
||||||
pthread_mutex_unlock(@p^.mutex);
|
pthread_mutex_unlock(@p^.mutex);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -890,7 +884,6 @@ begin
|
|||||||
rtlEventDestroy :=@intrtlEventDestroy;
|
rtlEventDestroy :=@intrtlEventDestroy;
|
||||||
rtlEventSetEvent :=@intrtlEventSetEvent;
|
rtlEventSetEvent :=@intrtlEventSetEvent;
|
||||||
rtlEventResetEvent :=@intrtlEventResetEvent;
|
rtlEventResetEvent :=@intrtlEventResetEvent;
|
||||||
rtlEventStartWait :=@intrtlEventStartWait;
|
|
||||||
rtleventWaitForTimeout :=@intrtleventWaitForTimeout;
|
rtleventWaitForTimeout :=@intrtleventWaitForTimeout;
|
||||||
rtleventWaitFor :=@intrtleventWaitFor;
|
rtleventWaitFor :=@intrtleventWaitFor;
|
||||||
// semaphores
|
// semaphores
|
||||||
|
@ -414,14 +414,6 @@ begin
|
|||||||
ResetEvent(THANDLE(AEvent));
|
ResetEvent(THANDLE(AEvent));
|
||||||
end;
|
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);
|
procedure intRTLEventWaitFor(AEvent: PRTLEvent);
|
||||||
const
|
const
|
||||||
INFINITE=dword(-1);
|
INFINITE=dword(-1);
|
||||||
@ -471,7 +463,6 @@ begin
|
|||||||
RTLEventDestroy :=@intRTLEventDestroy;
|
RTLEventDestroy :=@intRTLEventDestroy;
|
||||||
RTLEventSetEvent :=@intRTLEventSetEvent;
|
RTLEventSetEvent :=@intRTLEventSetEvent;
|
||||||
RTLEventResetEvent :=@intRTLEventResetEvent;
|
RTLEventResetEvent :=@intRTLEventResetEvent;
|
||||||
RTLEventStartWait :=@intRTLEventStartWait;
|
|
||||||
RTLEventWaitFor :=@intRTLEventWaitFor;
|
RTLEventWaitFor :=@intRTLEventWaitFor;
|
||||||
RTLEventWaitForTimeout :=@intRTLEventWaitForTimeout;
|
RTLEventWaitForTimeout :=@intRTLEventWaitForTimeout;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user