Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. CSingleLock Assertion Failed

CSingleLock Assertion Failed

Scheduled Pinned Locked Moved C / C++ / MFC
c++debugginghelp
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mcgmil
    wrote on last edited by
    #1

    Hi I am using CSingleLock in a program with a primary thread and a worker thread. On start up or if I do certain operations (both in debug mode) the debuger throws up a Debug Assertion at line 160 in mtex.cpp. Line 160 shows the floowing ASSERT(!m_bAcquired); Does anybody know what the problem is as it’s driving me crazy. Thanks in advance. MTM

    D O 2 Replies Last reply
    0
    • M mcgmil

      Hi I am using CSingleLock in a program with a primary thread and a worker thread. On start up or if I do certain operations (both in debug mode) the debuger throws up a Debug Assertion at line 160 in mtex.cpp. Line 160 shows the floowing ASSERT(!m_bAcquired); Does anybody know what the problem is as it’s driving me crazy. Thanks in advance. MTM

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      mcgmil wrote:

      Line 160 shows the floowing ASSERT(!m_bAcquired);

      This apparently is not VC++ v6. Correct?


      "The largest fire starts but with the smallest spark." - David Crow

      "Judge not by the eye but by the heart." - Native American Proverb

      1 Reply Last reply
      0
      • M mcgmil

        Hi I am using CSingleLock in a program with a primary thread and a worker thread. On start up or if I do certain operations (both in debug mode) the debuger throws up a Debug Assertion at line 160 in mtex.cpp. Line 160 shows the floowing ASSERT(!m_bAcquired); Does anybody know what the problem is as it’s driving me crazy. Thanks in advance. MTM

        O Offline
        O Offline
        o sanchez
        wrote on last edited by
        #3

        How are you creating the singlelock? it seems that the syncobject you are using its not valid. Example: CCriticalSection g_CS; //global or class member func() { CSingleLock SLock(&g_CS, TRUE); } Good luck. -- modified at 8:50 Wednesday 12th July, 2006

        M 1 Reply Last reply
        0
        • O o sanchez

          How are you creating the singlelock? it seems that the syncobject you are using its not valid. Example: CCriticalSection g_CS; //global or class member func() { CSingleLock SLock(&g_CS, TRUE); } Good luck. -- modified at 8:50 Wednesday 12th July, 2006

          M Offline
          M Offline
          mcgmil
          wrote on last edited by
          #4

          I am Using Visual C++ Standard 2003 In the document header are the following declarations CCriticalSection ImageInfoSyncObject; CSingleLock * pImageInfoLock; In the constructor of the document .ccp file a new single lock object is created CDoc::CDoc() { pImageInfoLock = new CSingleLock (&ImageInfoSyncObject); } Then I use the lock and unlock within a function. Void CDoc::Function() { pImageInfoLock->Lock (); //Code . . . . pImageInfoLock->UnLock (); } Has anybody any further ideas as to why I get the Debug Assertion Failure for mtex.ccp line 106 Thanks MTM

          O 1 Reply Last reply
          0
          • M mcgmil

            I am Using Visual C++ Standard 2003 In the document header are the following declarations CCriticalSection ImageInfoSyncObject; CSingleLock * pImageInfoLock; In the constructor of the document .ccp file a new single lock object is created CDoc::CDoc() { pImageInfoLock = new CSingleLock (&ImageInfoSyncObject); } Then I use the lock and unlock within a function. Void CDoc::Function() { pImageInfoLock->Lock (); //Code . . . . pImageInfoLock->UnLock (); } Has anybody any further ideas as to why I get the Debug Assertion Failure for mtex.ccp line 106 Thanks MTM

            O Offline
            O Offline
            o sanchez
            wrote on last edited by
            #5

            If i put this code in a function it works perfectly (in VS2005), Try it: { CCriticalSection ImageInfoSyncObject; CSingleLock * pImageInfoLock; pImageInfoLock = new CSingleLock(&ImageInfoSyncObject); pImageInfoLock->Lock(); pImageInfoLock->Unlock(); }

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups