Channel & fiber queue

Options
Sergiy
Sergiy
edited June 2012 in Photon Server
Consider following code:
_executionFiber = new PoolFiber();
_executionFiber.Start();
InfoChannel.Subscribe(_executionFiber, SomeMethod);

Will SomeMethod run in _executionFiber's queue? I mean - will the functionality be the same as
_executionFiber.Enqueue(SomeMethod)
?

Comments

  • Tobias
    Options
    I'm not a retlang expert and Ben is not around now. He will answer in a while.

    Despite this, in the first code snippet you subscribe to whatever happens in the InfoChannel. SomeMethod is then used whenever the _executionFiber executes messages from the InfoChannel.
    The second snippet Enqueues something into the _executionFiber. SomeMethod is the message and being executed when the fiber executes your message. This is a one-time thingy.

    I think ;)
  • Sergiy
    Options
    I agree with you, Tobias. First code snippet could be executed many times, while second one - only once. But that doesn't matter here. The question is - will the method that is subscribed via channel, execute in fiber's queue?
  • Tobias
    Options
    Ah, I didn't get that.
    Yes. The _executionFiber is the execution context for the subscription. Each subscribe can have it's own execution thread/context.