Search Unity

JobHandle atomicity and default value.

Discussion in 'Data Oriented Technology Stack' started by OswaldHurlem, Feb 13, 2018.

  1. OswaldHurlem

    OswaldHurlem

    Joined:
    Jan 6, 2017
    Posts:
    40
    I have a JobHandle field and want to denote it as not corresponding to any existent job. What's the preferred semantic for this? default(JobHandle)? Also, is JobHandle atomic?
     
  2. Joachim_Ante

    Joachim_Ante

    Unity Technologies

    Joined:
    Mar 16, 2005
    Posts:
    4,671
    default(JobHandle) or new JobHandle() both works fine. It is a struct so initializes it to zeros.

    JobHandle struct itself is not atomic, and I dont know of any situation where that would be useful.
     
  3. OswaldHurlem

    OswaldHurlem

    Joined:
    Jan 6, 2017
    Posts:
    40
    It would be useful if I wanted to schedule a job off the main thread (which I see is unsupported, fair enough).