1
$\begingroup$

A program runs in a low-spec hardware utilizes coroutines writes to a single socket but how does the socket know when the data should be sent as there could more coroutines writing given N time.

I find this problem similar to The halting problem even tho contexts are different.

Does anyone know how could be a one find a optimal solution to solve this problem?

$\endgroup$
3
  • $\begingroup$ If there were only one routine, how would the socket know when the data should be sent? $\endgroup$
    – Kyle Jones
    Dec 1 '20 at 3:23
  • $\begingroup$ @KyleJones Would there be more routines or just 1 forever? $\endgroup$
    – jeffbRTC
    Dec 1 '20 at 4:10
  • $\begingroup$ @KyleJones If it's one, the socket would send data one by one without waiting $\endgroup$
    – jeffbRTC
    Dec 1 '20 at 4:10
0
$\begingroup$

I ended up using a buffer limit and a queue.

I knew that this may not answer this question fully but it's the only optimal solution I could find.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.