Jump to content

Need help troubleshooting Multithreading / Future Pattern script


Recommended Posts

I'm testing out integrating multithreading using the Futures Pattern for a mod I am porting to SSE.

 

I've setup the scripts around my existing core scripts but I'm hitting a wall.

When passing an actor reference from my main scripts OnHit event to the Thread worker it, more often than not, loses the reference and I end up with None based errors.

 

In debugging, traces/notifications in the Thread Worker[TW] show the reference landed there but when it comes to passing those values to the TW's local functions they result in None on execution.

 

I can't tell if it's firing to fast but it almost feels like that as I know by the time I see a notification those functions have long been fired, in terms of papyrus processing time.

Testing while loops, with/without waits, throws expected errors and overflows, hence the wall my head is smashed against repeatedly.

 

I'm still trying to wrap my head around threads and the voodoo that they do.

Anyone well versed in multithreaded scripts got any theories?

 

Link to comment
Share on other sites

Crisis Averted!

 

I've reworked the scripts overall and implemented some better flow control on the ThreadWorker script using OnUpdate/RegisterForSingleUpdate which is much cleaner and doesn't seem to lead to overflows like when trying to use While/Waits.

As well, I've utilized some locks for additional control at key points.

 

I'll try to post some scripts once I've cleaned them up a bit but for now I can finally refocus my energy/time on the next stage as this issue has delayed me waaay to long!

Link to comment
Share on other sites

  • Recently Browsing   0 members

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