Jump to content




Coroutine Manager


4 replies to this topic

#1 ObloxCC

  • Members
  • 38 posts

Posted 18 February 2017 - 08:35 PM

How will I go along creating a coroutine manager? I'm having some trouble switching between coroutines (both start, then then one continues without switching back to the other, also only one receives info from the event).

#2 Lupus590

  • Members
  • 2,012 posts
  • LocationUK

Posted 18 February 2017 - 09:34 PM

Two things:
first, BBs guide to coroutines
second, have a look at how the built in coroutine manager works

#3 H4X0RZ

  • Members
  • 1,315 posts
  • LocationGermany

Posted 18 February 2017 - 10:29 PM

Most of the time people ask how to write their own coroutine manager the standard parallel API is enough already. Have you tried parallel and are not satisfied with it?

#4 ObloxCC

  • Members
  • 38 posts

Posted 18 February 2017 - 10:59 PM

View PostH4X0RZ, on 18 February 2017 - 10:29 PM, said:

Most of the time people ask how to write their own coroutine manager the standard parallel API is enough already. Have you tried parallel and are not satisfied with it?

I have tried, and it just can't work in the way I need it too

#5 H4X0RZ

  • Members
  • 1,315 posts
  • LocationGermany

Posted 19 February 2017 - 01:22 AM

View PostObloxCC, on 18 February 2017 - 10:59 PM, said:

View PostH4X0RZ, on 18 February 2017 - 10:29 PM, said:

Most of the time people ask how to write their own coroutine manager the standard parallel API is enough already. Have you tried parallel and are not satisfied with it?

I have tried, and it just can't work in the way I need it too

in addition to Lupus stuff here's a general idea of how a simple coroutine manager kinda works:
loop until every coroutine is dead -> fetch an event -> loop over every coroutine and check if has an event filter and is not dead; compare the event to the filter and if no filter is set or it fits the filter resume the coroutine with the unpacked event as arguments, save the return value as new filter -> repeat





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users