CreateEvent Function

Action

Uses the Win32 CreateEventEx function to create a named event object.

Include file

Kernel.bdh

Syntax

CreateEvent(in sEvtName: string): number;

Return value

handle to the event object

Parameter Description
sEvtName Name of the event object

Example

dcluser
user
Starter
transactions
TMain : begin;
EventStarter : 20;
CleanUp : end;
user
Seller(5)
transactions
TMain : begin;
Selling : 20;
CleanUp : end;
var
hEventGo: number; // handle for starting event
dcltrans
transaction TMain
begin
// creates a named event object
hEventGo := CreateEvent("MyStarterEvent");
...
...
end TMain;
transaction EventStarter
begin
wait 10.0;
// every 10 seconds the starter event forces all seller users
// to execute the selling transaction at the same time
PulseEvent(hEventGo);
end EventStarter;
transaction Selling
begin
WaitForSingleObject(hEventGo,12000); // wait maximal 12 sec.
...
end Selling;
transaction CleanUp
begin
CloseHandle(hEventGo);
end CleanUp;

Sample scripts

Trans.bdf