Exemplo n.º 1
0
    public bool EvalQueuedRequests()
    {
        bool had_request = false;

        while (true)         // how exactly do locks interact with exceptions ? control flow statements like break ?
        {
            REQ_Base Msg      = null;
            bool     have_msg = false;
            lock ( requests ) {
                if (requests.Count > 0)
                {
                    have_msg = true; Msg = requests.First(); requests.RemoveFirst();
                }
            }
            if (!have_msg)
            {
                break;
            }

            try {
                had_request = true;      // <- this is for triggering in editor redraws - perfer fals positives over missing one ( a request might fail during execution but still cause side effects )
                // -- ( EVAL ) --
                RESP_Base Resp = Multiplex(Msg);

                // -- ( PRINT ) --
                JAdapter.Write(Resp);
            } catch (System.IO.IOException io_e) {
                network_failure_in_eval        = true;
                network_failure_in_eval_Reason = io_e;
                break;
            }
        }
        return(had_request);
    }
Exemplo n.º 2
0
    public void EvalQueuedRequests()
    {
        while (true)         // how exactly do locks interact with exceptions ? control flow statements like break ?
        {
            REQ_Base Msg      = null;
            bool     have_msg = false;
            lock ( requests ) {
                if (requests.Count > 0)
                {
                    have_msg = true; Msg = requests.First(); requests.RemoveFirst();
                }
            }
            if (!have_msg)
            {
                break;
            }

            try {
                // -- ( EVAL ) --
                RESP_Base Resp = Multiplex(Msg);

                // -- ( PRINT ) --
                JAdapter.Write(Resp);
            } catch (System.IO.IOException io_e) {
                network_failure_in_eval        = true;
                network_failure_in_eval_Reason = io_e;
                break;
            }
        }
    }
Exemplo n.º 3
0
 public RESP_Base Multiplex(REQ_Base request)
 {
     if (request is AC_Req)
     {
         return(OPS.AC((AC_Req)request, TMP_dumping_ground.GetAST_ptokBase));
     }
     else if (request is EVAL_Req)
     {
         return(OPS.EVAL_stateless((EVAL_Req)request, analyz0r: use_analyz0r));
     }
     else
     {
         throw new NotImplementedException();
     }
 }