Difference between revisions of "Creating Multithreaded Skyrim Mods"

Jump to navigation Jump to search
m
no edit summary
imported>Chesko
imported>Chesko
m
Line 125: Line 125:
<source lang="papyrus">
<source lang="papyrus">
     ObjectReference my_sword_future = ThreadManager.PlaceAtMeAsync(Sword)
     ObjectReference my_sword_future = ThreadManager.PlaceAtMeAsync(Sword)
    ThreadManager.wait_all()
</source>
</source>


<code>PlaceAtMeAsync</code> is a function we've written that gets assigned to a thread. A thread that has been given data to work on is referred to as being '''queued'''. <code>wait_all()</code> tells the Thread Manager that it should start running any queued threads and that we will wait until they're finished.


Later, when we decide we want the result of <code>PlaceAtMeAsync(Sword)</code>, we just ask for it:
Later, when we decide we want the result of our thread, we just ask for it:




Anonymous user

Navigation menu