Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:37:49+00:00 2026-06-15T21:37:49+00:00

I was dealing with threads and have a potential deadlock problem. Someone mentioned to

  • 0

I was dealing with threads and have a potential deadlock problem. Someone mentioned to me about a loader lock.

I couldn’t find much information online. Can someone please help me and explain, “What is a Loader Lock” ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:37:50+00:00Added an answer on June 15, 2026 at 9:37 pm

    For example, review this question:

    Loader lock error

    The general idea of loader lock: The system runs the code in DllMain inside a lock (as in – synchronization lock). Therefore, running non-trivial code inside DllMain is "asking for a deadlock"

    Answer I’ve mentioned is based on this article:

    Another reason not to do anything scary in your DllMain: Inadvertent deadlock

    Your DllMain function runs inside the loader lock, one of the few times the OS lets you run code while one of its internal locks is held. This means that you must be extra careful not to violate a lock hierarchy in your DllMain; otherwise, you are asking for a deadlock.

    The loader lock is taken by any function that needs to access the list of DLLs loaded into the process. This includes functions like GetModuleHandle and GetModuleFileName. If your DllMain enters a critical section or waits on a synchronization object, and that critical section or synchronization object is owned by some code that is in turn waiting for the loader lock, you just created a deadlock:

    // global variable
    CRITICAL_SECTION g_csGlobal;
    
    // some code somewhere
    EnterCriticalSection(&g_csGlobal);
    ... GetModuleFileName(MyInstance, ..);
    LeaveCriticalSection(&g_csGlobal);
    
    BOOL WINAPI
    DllMain(HINSTANCE hinstDLL, DWORD fdwReason,
            LPVOID lpvReserved)
    {
      switch (fdwReason) {
      ...
      case DLL_THREAD_DETACH:
       EnterCriticalSection(&g_csGlobal);
       ...
      }
      ...
    }
    

    Please review the whole article for full understanding.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm dealing with a problem the whole week already and can't find the answer
Ok, so, I have a different kind of problem when dealing with Radio button
So I have two tables for dealing with messages threads and messages . messages:
When i was dealing with threads concept in Java, i have seen Thread.java source
I have been learning about locking on threads and I have not found an
I need some help dealing with three Threads in Android One thread is the
Other questions dealing with use of match_parent pre 2.2 have answers stating one should
When dealing with threads (specifically in C++) using mutex locks and semaphores is there
I have big troubles dealing with a website I want to make a searchfunction
I have a problem which requires me to parse several log files from a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.