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. Ensuring code runs synchronously

Ensuring code runs synchronously

Scheduled Pinned Locked Moved C / C++ / MFC
4 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.
  • F Offline
    F Offline
    ForNow
    wrote on last edited by
    #1

    Is a crtical section a way of ensuring the your code runs synchrounsly as window message processing seems to take precedence in code execution

    L B 3 Replies Last reply
    0
    • F ForNow

      Is a crtical section a way of ensuring the your code runs synchrounsly as window message processing seems to take precedence in code execution

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      It ensures only one thread can go through that code path: see Critical Section Objects (Windows)[^].

      ForNow wrote:

      window message processing seems to take precedence

      Not sure what you mean by that.

      1 Reply Last reply
      0
      • F ForNow

        Is a crtical section a way of ensuring the your code runs synchrounsly as window message processing seems to take precedence in code execution

        B Offline
        B Offline
        Bram van Kampen
        wrote on last edited by
        #3

        In Short, No! Critical Sections are Synchronisation Objects, It is of use only if your project is multi threaded,ie Has More than One thread running in the One Program. Each thread of your program, will wait in front of a CriticalSection where you try to Enter It, until all other threads leave it. It is a communal comunication deal between threads in a program. One thread of a program will not allow another thread to run, until the section is released. Other programs can switch thread in the mean time. The Nature and context of the question worries me! You seem to have to learn an awfull lot more before you are ready to discus critical sections :)

        Bram van Kampen

        1 Reply Last reply
        0
        • F ForNow

          Is a crtical section a way of ensuring the your code runs synchrounsly as window message processing seems to take precedence in code execution

          B Offline
          B Offline
          Bram van Kampen
          wrote on last edited by
          #4

          No, It is NOT, and I explained that already! However, I also answered your other question, in quite a lot of detail. Before you can attempt to learn MFC Multi Threaded Programming, you will need to learn basic MFC Programming, and elements of the Windows SDK. MFC is a thin wrapper around the Windows SDK. Sometimes you need the real thing! Definitely needed in Multithreading. Cannot Help it, You need to study more before we can help you. Bram

          Bram van Kampen

          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