Esempio 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);
    }
Esempio 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;
            }
        }
    }