How can I cancel a schedule in iFiber??
Options
In Loadbalancing project.
In Game.cs
I really love to use ExecutionFiber for all Timer functions.
So I have a dictionary of <int, IDisposable> and use them as a set of scheduled actions.
When I schedule action, I add a new IDisposable with it's hashId as a key.
Of course in the action, I remove the IDispoable from the dictionary and dispose it.
And then if a cancel schedule operation has come. I find it from dictionary and do the same.
I mean I remove the IDispoable from the dictionary and dispose it.
But it seams like this model is not working as a schedule manager.
I cant get my action functions running.
I wonder whether i'm dealing with Ifiber properly
Thx for the help in advance!
In Game.cs
I really love to use ExecutionFiber for all Timer functions.
So I have a dictionary of <int, IDisposable> and use them as a set of scheduled actions.
When I schedule action, I add a new IDisposable with it's hashId as a key.
Of course in the action, I remove the IDispoable from the dictionary and dispose it.
And then if a cancel schedule operation has come. I find it from dictionary and do the same.
I mean I remove the IDispoable from the dictionary and dispose it.
But it seams like this model is not working as a schedule manager.
I cant get my action functions running.
I wonder whether i'm dealing with Ifiber properly
Thx for the help in advance!
0
Comments
-
hi, locus84.
Yes, you do it right. When you call Dispose scheduled action are canceled.
you could check implementation details here
https://code.google.com/p/retlang/sourc ... rAction.cs0 -
Thank you chvetsov!
Yeah of course, I've checked that.
There were some confusions between TimeSpan and DateTime Calculation.
Now I see my fibers working fine GOOOOOOOOOOOOOOOOOOOOOOOOOOOD!
BTW, is it big deal to have a poolfiber per clientPeer for the server performance??
For now, I'm using ApplicationStat class' poolfiber for handling my peer's estimated timeout actions Like
DisconnectAfterTime(long timeMS), SendAuthFaild_DisconnectAfterTime(long timeMS);0 -
>> BTW, is it big deal to have a poolfiber per clientPeer for the server performance??
you have it already PeerBase.RequestFiber. you may use it for your own tasks.0