Some todo.
[brdnet.git] / TestWatch.pas
blob938e1a863ab69f3a5e13a12bbfdd95d004d80af5
1 unit TestWatch;
3 INTERFACE
4 IMPLEMENTATION
5 uses ServerLoop,SysUtils;
7 type tObj=object
8 var f:text;
9 var h:tHandle;
10 procedure Event1(ev:Word);
11 procedure Event2;
12 procedure Init;
13 end;
15 procedure tObj.Init;
16 begin
17 assign(f,'');
18 reset(f);
19 h:=GetFileHandle(f);
20 writeln('TestWatch: Input handle ',h);
21 WatchFD(h,@Event1);
22 end;
24 procedure tObj.Event1(ev:Word);
25 begin
26 writeln('TestWatch: Event1 ',IntToHex(ev,4));
27 readln;
28 writeln('TestWatch: shedule ev2');
29 Shedule(1000,@Event2);
30 end;
31 procedure tObj.Event2;
32 begin
33 writeln('TestWatch: Event2 ');
34 end;
36 procedure Test;
37 var o:^tObj;
38 begin
39 if OptIndex('-test-watch')>0 then begin
40 new(o);
41 o^.Init;
42 end;
43 end;
45 BEGIN
46 test;
47 END.