Search Unity

self scheduling job

Discussion in 'Entity Component System' started by sebas77, Feb 14, 2019.

  1. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,644
    is there the concept of self scheduling / re-entrant job or can it be achieved some how?

    I am talking about a job the schedules itself again (without entering in an infinite loop of course)

    a ever lasting job (until killed) may be also interesting.
     
  2. elcionap

    elcionap

    Joined:
    Jan 11, 2016
    Posts:
    138
    Currently you can't schedule a job outside of the main thread.

    []'s
     
    sebas77 likes this.
  3. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,644
    I guess if I add a while (true) inside a job I would break the system?
     
  4. Tony_Max

    Tony_Max

    Joined:
    Feb 7, 2017
    Posts:
    353
    It will be an infinite job
     
  5. elcionap

    elcionap

    Joined:
    Jan 11, 2016
    Posts:
    138
    sebas77 likes this.
  6. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,644
    OK thanks I may try that then :)
     
  7. elcionap

    elcionap

    Joined:
    Jan 11, 2016
    Posts:
    138
    Be aware that there is no way to force a job to abort. You need to take care of this by yourself.

    []'s
     
  8. sebas77

    sebas77

    Joined:
    Nov 4, 2011
    Posts:
    1,644
    yeah I will use something like while (_running)
     
  9. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    5,203
    Can you tell me what you are trying to achieve?

    In my experience the concept of forever running jobs is almost always a bad idea.
     
  10. starikcetin

    starikcetin

    Joined:
    Dec 7, 2017
    Posts:
    340
    Can't you run a system on the main thread that periodically invokes the said job?
     
  11. Sibz9000

    Sibz9000

    Joined:
    Feb 24, 2018
    Posts:
    149
    What your asking for is most probably not the best way of going about things. I would try find another solution.
     
  12. Antypodish

    Antypodish

    Joined:
    Apr 29, 2014
    Posts:
    10,780
    Important detail has been missed here. Do yo want loop job independently from frame, or can your job run once per frame?