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. About CMutex And CSingleLock

About CMutex And CSingleLock

Scheduled Pinned Locked Moved C / C++ / MFC
question
2 Posts 2 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.
  • D Offline
    D Offline
    Diglu
    wrote on last edited by
    #1

    I'm using CSingleLock , When one thread lock an object, and other thread wants to lock that object at that time , The second thread will wait for unlocking by the 1st thread or it just skip that locking code. If it need to wait, It will automatically wait or have to give code to wait ? -------------------------------------------------------------------------- CMutex g_m1; CSingleLock lock1(&g_m1) - - - - - - - -- - - - - - - - - - - - - - - - - - - - if (lock1.Lock()) { m_LockStatus = "Got Lock"; UpdateData(FALSE); } else { m_LockStatus = "Failed"; UpdateData(FALSE); } } ----------------------------------------------------------------------------- Thanks to all.:)

    F 1 Reply Last reply
    0
    • D Diglu

      I'm using CSingleLock , When one thread lock an object, and other thread wants to lock that object at that time , The second thread will wait for unlocking by the 1st thread or it just skip that locking code. If it need to wait, It will automatically wait or have to give code to wait ? -------------------------------------------------------------------------- CMutex g_m1; CSingleLock lock1(&g_m1) - - - - - - - -- - - - - - - - - - - - - - - - - - - - if (lock1.Lock()) { m_LockStatus = "Got Lock"; UpdateData(FALSE); } else { m_LockStatus = "Failed"; UpdateData(FALSE); } } ----------------------------------------------------------------------------- Thanks to all.:)

      F Offline
      F Offline
      FarPointer
      wrote on last edited by
      #2

      you may try :- WaitForSingleObject Regards, FarPointer Blog:FARPOINTER

      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