Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Dear Pete,

hope you are enjoying your holiday!

I'm working on converting vasFMC (http://vas-project.org/), a standalone FMC, so it will work as a gauge within FS9. vasFMC uses OpenGL to draw its display, and I have to use a rather roundabout route to get the result to display in a gauge. As a result, a gauge update takes relatively long (around 30 ms), so I have decided to run all of the vasFMC code in a separate thread to minimize the impact on FS frame rates.

OK, after this rather long introduction... here's my question: vasFMC uses FSUIPC to query FS9 (after all, it's originally a standalone program), so this means that I am doing FSUIPC_Process calls from a separate thread. Judging from the discussion in this thread:

viewtopic.php?f=54&t=6980&view=next

it seems that this works OK because FSUIPC uses SendMessageTimeout to call into FS9 -- so everything should synchronize nicely. I just wanted to confirm with you that what I'm doing is in fact OK...

I realize that SendMessageTimeout may block my thread for a while until FS9's message loop can process the message, but that's not a major concern for me...

Thanks, and best regards,

Martin

Posted

Sorry for the delay in replying -- as mentioned in the Announcements above, my wife and I were off touring Argentina & Chile (by steam trains where possible) immediately after I returned to the UK from the AVSIM FanCon in Seattle.

... this means that I am doing FSUIPC_Process calls from a separate thread. Judging from the discussion in this thread:

viewtopic.php?f=54&t=6980&view=next

it seems that this works OK because FSUIPC uses SendMessageTimeout to call into FS9 -- so everything should synchronize nicely. I just wanted to confirm with you that what I'm doing is in fact OK...

If you are calling FSUIPC from a Gauge or DLL within FS, you should NOT be using the external interface with memory mapped files and SendMessageTimeOut, but the special internal interface which is far far more efficient.

That uses SendMessage (no timeout), which from a separate thread is treated a bit like PostMessage but making your thread wait for the WndProc exit. So it should still be okay.

Regards

Pete

Posted
Sorry for the delay in replying -- as mentioned in the Announcements above, my wife and I were off touring Argentina & Chile (by steam trains where possible) immediately after I returned to the UK from the AVSIM FanCon in Seattle.

Don't apologize for going on holiday... :wink: Hope you had a good time!

If you are calling FSUIPC from a Gauge or DLL within FS, you should NOT be using the external interface with memory mapped files and SendMessageTimeOut, but the special internal interface which is far far more efficient.

That's understood... I was just using the "external" interface for the time being because I was lazy... but I've now converted to the internal interface, and it works a treat.

That uses SendMessage (no timeout), which from a separate thread is treated a bit like PostMessage but making your thread wait for the WndProc exit. So it should still be okay.

OK, that's good to hear... My experience seems to bear this out -- I've been running the code for a while now without any problems.

Thanks for the quick answer!

Martin

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.