Jump to content
  • Advertisement
Sign in to follow this  
nuclear123

disablethreadlibcalls()?

This topic is 2631 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i've read threads stateing that calling disablethreadlibrarycalls() after dll_attach can help increase performance of your program if it uses alot of DLL's. I've read documentation on msdn but not sure if i correctly understand how it helps. Here is my simplistic understanding of it and tell me if i'm correct.

"if you do disablethreadlibrarycalls() then your program will pretty much disable event notifications for that specific dll's entrypoint( dll main ) and prevent haveing to check the events constantly. Therefore if you call this function you will be unable to detach your dll?"

Share this post


Link to post
Share on other sites
Advertisement
This specifically prevents the DLL from getting notified every time it is attached to a new thread (or detached from a single thread). This shouldn't affect attachment/unloading for the entire process, IIRC.

The only time you really want to do this is if:
  • Your program loads a huge number of DLLs (for "huge", I mean probably at least 30, although I just made that number up)
  • Your program spawns and terminates a huge number of threads (think dozens per second)
  • Your program is absolutely performance critical and/or a few KB of memory is precious
  • All of the warnings and caveats about the function are not problematic

    In other words, you probably don't need (or even want) to mess with this. If you just have 3-4 DLLs and spin up threads fairly rarely (as you should be doing!) then this won't make any visible difference for your program.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!