Jump to content

Can anyone explain nested functions and threading?


FireFlickerFlak

Recommended Posts

I recently saw a thread where someone said that the problem with someones script was that it had "nested" function which meant it was not threadsafe. My understanding is that basically different threads are different processing streams and that it is best to keep each thread focused on its own area of the code. I am not sure how this applies to papyrus though.

 

My main concern is that I have a lot of function that I am storing in quest scripts and I am not sure when it is not safe to store function in a quest script and when it is safe. Should I not be storing any functions other than global functions in quest script?

Link to comment
Share on other sites

The real question is what is calling the functions?

 

Could two or more things be calling it at once? As in if it was a function being called by a spell any number of npcs could cast it at once, this could be a problem since they might be acting on the same data.

 

I am also not well versed in papyrus though.

Link to comment
Share on other sites

Most of the scripts are for spells, but each magic effect instance is uniquely generated by the game so the scripts should be fine I think in that case.

Either way, isn't it fine for multiple scripts to call the same function at the same time as long as they are not manipulating the same objects at the same time? Or are quest functions not able to be used by more than one source at a time?

 

Edit; Oh, didnt see that link, thanks!

Edited by FireFlickerFlak
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...