CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Threaded View

  1. #1
    Join Date
    Jul 2008
    Posts
    28

    Exclamation STL hashmap,vector crashing

    hi all,

    i have a service application, which maintains a record of each and every USB being used in the windows system.

    in brief, my problem is with the hashmap values getting corrupted in between two threads. one thread picks the database path where values are to be written and other thread writes into that database path.

    Service crashes at the, when the below codes are executed.



    WaitForSingleObject(*hThreadIterBegin->second,INFINITE);

    rename(hThreadIterBegin->first->c_str(),newFileName.c_str());

    ReleaseMutex(*hThreadIterBegin->second);



    The first thread fetches the values and the values are sent to the second thread so that it can write the necessary things to the fetched value which is the path of the database. but the hashmap value crashes at some point due to which the service crahses at above code executions.



    i am not able to identify the exact reason, as to why the value of ThreadMutexMapPrimary changes or crashes when it is called from the second thread???

    i am attaching the code below, with declarations and values i received while debugging.

    Thankyou.
    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured