langs a-z
This commit is contained in:
parent
db842d013d
commit
d066446780
11389 changed files with 98361 additions and 1020 deletions
29
Task/Events/Oz/events-1.oz
Normal file
29
Task/Events/Oz/events-1.oz
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
declare
|
||||
fun {NewEvent}
|
||||
{NewCell _}
|
||||
end
|
||||
|
||||
proc {SignalEvent Event}
|
||||
@Event = unit
|
||||
end
|
||||
|
||||
proc {ResetEvent Event}
|
||||
Event := _
|
||||
end
|
||||
|
||||
proc {WaitEvent Event}
|
||||
{Wait @Event}
|
||||
end
|
||||
|
||||
E = {NewEvent}
|
||||
in
|
||||
thread
|
||||
{System.showInfo "[2] Waiting for event..."}
|
||||
{WaitEvent E}
|
||||
{System.showInfo "[2] Received event."}
|
||||
end
|
||||
|
||||
{System.showInfo "[1] Waiting 1 second..."}
|
||||
{Delay 1000}
|
||||
{System.showInfo "[1] Signaling event."}
|
||||
{SignalEvent E}
|
||||
13
Task/Events/Oz/events-2.oz
Normal file
13
Task/Events/Oz/events-2.oz
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
declare
|
||||
E
|
||||
in
|
||||
thread
|
||||
{System.showInfo "[2] Waiting for event..."}
|
||||
{Wait E}
|
||||
{System.showInfo "[2] Received event."}
|
||||
end
|
||||
|
||||
{System.showInfo "[1] Waiting 1 second..."}
|
||||
{Delay 1000}
|
||||
{System.showInfo "[1] Signaling event."}
|
||||
E = unit
|
||||
20
Task/Events/Oz/events-3.oz
Normal file
20
Task/Events/Oz/events-3.oz
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
declare
|
||||
MyPort
|
||||
in
|
||||
thread
|
||||
MyStream
|
||||
in
|
||||
{NewPort ?MyStream ?MyPort}
|
||||
{System.showInfo "[2] Waiting for event..."}
|
||||
for Event in MyStream do
|
||||
{System.showInfo "[2] Received event."}
|
||||
{System.showInfo "[2] Waiting for event again..."}
|
||||
end
|
||||
end
|
||||
|
||||
for do
|
||||
{System.showInfo "[1] Waiting 1 second..."}
|
||||
{Delay 1000}
|
||||
{System.showInfo "[1] Signaling event."}
|
||||
{Port.send MyPort unit}
|
||||
end
|
||||
12
Task/Events/PureBasic/events.purebasic
Normal file
12
Task/Events/PureBasic/events.purebasic
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
OpenWindow (0, 10, 10, 150, 40, "Event Demo")
|
||||
ButtonGadget (1, 10, 10, 35, 20, "Quit")
|
||||
|
||||
Repeat
|
||||
|
||||
Event = WaitWindowEvent()
|
||||
|
||||
If Event = #PB_Event_Gadget And EventGadget() = 1
|
||||
End
|
||||
EndIf
|
||||
|
||||
ForEver
|
||||
Loading…
Add table
Add a link
Reference in a new issue