Menu

Handling blocking protocols in an AO

2019-11-16
2019-11-17
  • burak kirazli

    burak kirazli - 2019-11-16

    Hello,

    My question is about handling syncronous (blocking) protocols in an ao. What i wonder is that when i use a syncronous protocol like http, which is running in a request-response manner, is Active Object pattern a wrong choice for this situation?

    The QP philosphy always emphasizes that, AOs should not block.

    Thanks.

     
  • Quantum Leaps

    Quantum Leaps - 2019-11-17

    Blocking in the middle of event processing is incompatible with the event-driven paradim. In QP such blocking inside an active object can cause unbounded accumulation of events for that AO and possible overflow of its queue. In that case QP will assert. Of course, this is in addition to the AO being unresponsive to any events while it is blocked.

    Therefore, if you cannot get rid of blocking inside a piece of code, you need to run that code in a traditional thread that can block (in QXK such threads are called extended threads). Of course for this to work, you need to use a real-time kernel that allows blocking. This could be either a 3rd-party kernel, or the just mentioned QXK.

    But specifically to HTML, there are non-blocking implementations. For example, you might watch a Video "lwIP TCP/IP stack and QP framework", which shows a running web-server on an embedded device with the non-blocking lwIP TCP/IP stack. There is also an AppNote "QP™ and lwIP (TCP/IP Stack)" explaining this.

    --MMS

     

    Last edit: Quantum Leaps 2019-11-17

Log in to post a comment.

MongoDB Logo MongoDB