Results 1 to 6 of 6

Thread: working with exec_async

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Sergeant maxdamage99's Avatar
    Join Date
    Aug 2014
    Location
    Russia
    Posts
    458
    Thanks
    79
    Thanked 122 Times in 101 Posts
    maybe I misunderstood you, but ..

    PHP Code:
    execute_aCD()
    {
        
    exec_async_checkdone();
    }

    aExecute_getID()
    {
        
    id level.sv_dataVar["tech"]["exec_count"];
        
    level.sv_dataVar["tech"]["exec_count"]++;
        
        return 
    id;
    }

    aExecute_callback(resultid)
    {
        
    level.exec_buffer[id] = result;
        
    level notify("aExecute_" id);
    }

    aExecute(query)
    {
        
    printf("%\n"query);

        
    id aExecute_getID();
        
    exec_async_create(query, ::aExecute_callbackid);
        
        
    level waittill("aExecute_" id);
        
    result level.exec_buffer[id];
        
        return 
    result;
    }

    aExecute_(query)
    {
        
    printf("%\n"query);
        
    exec_async_create_nosave(query);

    server init:
    PHP Code:
    level.sv_dataVar["tech"]["exec_count"] = 0;
    level.exec_buffer = []; 
    call:
    PHP Code:
    result aExecute("php somework.php " arg1 " " arg2);
    if (!
    isDefined(result))
    {
        
    //execution error
    }

    if (
    result[0] == "ERROR")
    {
        
    //script executed but returned error

    this is for "undefined" if for some reason the script was not executed:
    https://github.com/damage99/libcod/b..._exec.cpp#L104


    it helped me with problem:
    the script was not executed (lack of RAM in my cases)

    all other errors (invalid arguments, wrong args types, etc.) can be processed already in the script itself (.sh, .php etc.)
    Last edited by maxdamage99; 1st June 2019 at 21:23.
    PHP Code:
    class CoronaVirus 
    {
       
    CoronaVirus(int m 1): multi(m) { Peoples.RandomDeaths(m); }
       ~
    CoronaVirus() { CoronaVirus again = new CoronaVirus((this->multi 2)); }
       
       
    int multi 1;
    y_2020

  2. The Following User Says Thank You to maxdamage99 For This Useful Post:

    Miri (2nd June 2019)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •