Solved Thread (lua)

Discussion in 'Rust Development' started by Мизантроп, Jun 8, 2015.

  1. is it possible the function in the thread to avoid hanging the server when performing long functions (while True then ... end)?
    [DOUBLEPOST=1433571386][/DOUBLEPOST]я пробовал
    Code:
    co = coroutine.create(function ()
               while true do
                 rank()
                 coroutine.yield()
               end
             end)coroutine.resume(co);
    but still freezes
    [DOUBLEPOST=1433768736,1433571107][/DOUBLEPOST]judging by the silence - there are no threads in lua?
     
  2. Your best bet would be to use a timer.
     
  3. I use. The point is, I have done a lot of mysql queries and at this point, the server freezes.
    [DOUBLEPOST=1433835221,1433825529][/DOUBLEPOST]Tried to make a thread in C# (I'm noob):

    Code:
    using System.Threading;...public void SystemTimerTick()
    {Thread t = new Thread(new ThreadStart(ThreadProc));
         
    t.Start();
        }
    if (timerr == 1) {
    Puts("{0}: {1}", Title, timerr.ToString());    }
    } 
    Code:
    [Oxide] 10:34 AM [Error] Failed to run a 1.00 timer in Sinhronize (UnauthorizedAccessException: System access is restricted, you are not allowed to use System.Threading.Thread)
    [Oxide] 10:34 AM [Debug] at Oxide.Plugins.Sinhronize.<Init>m__0 () [0x00000] in <filename unknown>:0
    at Oxide.Core.Libraries.Timer+TimerInstance.Update () [0x00000] in <filename unknown>:0 
    o_O
     
  4. https://github.com/OxideMod/Oxide/b...bef581c/Oxide.Ext.CSharp/CSharpPlugin.cs#L315
     
  5. Здарова. Пишешь на c#?
    [en]Hello. You write on c#?
     
  6. [ru] То есть можно выполнить вот так вот:
    [en] That is, you can do so here:

    Code:
    QueueWorkerThread( {
           Puts("Hi! I new Thread ))");
    });
    [ru] И оно будет работать?
    [en] And it will work?
     
  7. [ru] Неа
    [en] No
     
  8. It does not work is not one of the options ....
    Give please example
    [DOUBLEPOST=1433868977][/DOUBLEPOST]forum sleeping =(

    solution:
    Code:
    QueueWorkerThread(delegate {
            Puts("test");       
    });