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. Managed C++/CLI
  4. how to lock function used by thread?

how to lock function used by thread?

Scheduled Pinned Locked Moved Managed C++/CLI
tutorialquestion
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.
  • J Offline
    J Offline
    jone20132
    wrote on last edited by
    #1

    if i have a function will used by a thread, how i lock it? i do not want the thread to finish..., as below

    Main function()
    {
    ----lock this area
    code
    another function()
    code
    code
    ----unlock this area
    }

    basically the Main function wont be executed by another thread until it's done..? how?

    M 1 Reply Last reply
    0
    • J jone20132

      if i have a function will used by a thread, how i lock it? i do not want the thread to finish..., as below

      Main function()
      {
      ----lock this area
      code
      another function()
      code
      code
      ----unlock this area
      }

      basically the Main function wont be executed by another thread until it's done..? how?

      M Offline
      M Offline
      Malli_S
      wrote on last edited by
      #2

      Why don't you try Thread Synchronization mechanisms? Following may help you. Managed Thread Synchronization[^] How to create a Simple Lock Framework for C++ Synchronization[^]

      [Delegates]      [Virtual Desktop]      [Tray Me !]
      -Malli...! :rose:****

      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