You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since GO's goroutine is lightweight thread and GO's Channel is perfect Queue, is very easy to give every Proxy a goroutine and Event Que.
In every goroutine use a loop to get Event from Event Que and handle it.
The problem is how to "flush" a Proxy Event Que?
My anser is to use a Mark Event.
A Mark EventmarkEvt is a special Event which hold a ChannelmarkEvt.SyncCh=make(chan byte, 1).
When I wanna "flush" ProxypA's Event Que, I use Display.Sync to get a Callback, in Callback's DoneHandler I put a Mark EventmarkEvt in pA's Event Quech:=make(chan byte,1);pA.EvtQue<-&Event{SyncCh: ch}, and use <-ch to block my goroutine.
When pA's Event Handle Loop get a Eventevt that evt.SyncCh!=nil, it will use evt.SyncCh<-0 to unblock my goroutine.
The text was updated successfully, but these errors were encountered:
Since GO's goroutine is lightweight thread and GO's Channel is perfect Queue, is very easy to give every Proxy a goroutine and Event Que.
In every goroutine use a loop to get Event from Event Que and handle it.
The problem is how to "flush" a Proxy Event Que?
My anser is to use a Mark Event.
A Mark Event
markEvt
is a special Event which hold a ChannelmarkEvt.SyncCh=make(chan byte, 1)
.When I wanna "flush" Proxy
pA
's Event Que, I useDisplay.Sync
to get aCallback
, inCallback
'sDoneHandler
I put a Mark EventmarkEvt
inpA
's Event Quech:=make(chan byte,1);pA.EvtQue<-&Event{SyncCh: ch}
, and use<-ch
to block my goroutine.When
pA
's Event Handle Loop get a Eventevt
thatevt.SyncCh!=nil
, it will useevt.SyncCh<-0
to unblock my goroutine.The text was updated successfully, but these errors were encountered: