* Raise exception if BasicEventCreate fails in constructor (bug ID 30769)

git-svn-id: trunk@34988 -
This commit is contained in:
michael 2016-11-27 16:08:40 +00:00
parent 975dd13dcb
commit 76f7f81c85

View File

@ -28,6 +28,10 @@ const
INFINITE = Cardinal(-1);
type
ESyncObjectException = Class(Exception);
ELockException = Class(ESyncObjectException);
ELockRecursionException = Class(ESyncObjectException);
TWaitResult = (wrSignaled, wrTimeout, wrAbandoned, wrError);
TSynchroObject = class(TObject)
@ -79,6 +83,9 @@ type
implementation
Resourcestring
SErrEventCreateFailed = 'Failed to create OS basic event with name "%s"';
{ ---------------------------------------------------------------------
Real syncobjs implementation
---------------------------------------------------------------------}
@ -150,6 +157,8 @@ constructor TEventObject.Create(EventAttributes : PSecurityAttributes;
begin
FHandle := BasicEventCreate(EventAttributes, AManualReset, InitialState, Name);
if (FHandle=Nil) then
Raise ESyncObjectException.CreateFmt(SErrEventCreateFailed,[Name]);
FManualReset:=AManualReset;
end;