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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. is win32 memory mapping thread safe ?

is win32 memory mapping thread safe ?

Scheduled Pinned Locked Moved C / C++ / MFC
sysadmindata-structuressecurityperformancequestion
2 Posts 2 Posters 1 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.
  • R Offline
    R Offline
    Reza Shademani
    wrote on last edited by
    #1

    hi gang! am wondering if win32 memory mapping using "CreateFileMapping" ,"MapViewOfFile" ,"OpenFileMapping" ... is thread safe or not ? i mapped a queue in the file mapping section and i must know if this section is syncronized by default or i've to sync it manually . please give me u'r clues . many thanks in advance ! network security programmer from middle east!

    I 1 Reply Last reply
    0
    • R Reza Shademani

      hi gang! am wondering if win32 memory mapping using "CreateFileMapping" ,"MapViewOfFile" ,"OpenFileMapping" ... is thread safe or not ? i mapped a queue in the file mapping section and i must know if this section is syncronized by default or i've to sync it manually . please give me u'r clues . many thanks in advance ! network security programmer from middle east!

      I Offline
      I Offline
      Iain Clarke Warrior Programmer
      wrote on last edited by
      #2

      Short answer is no. Its not any more thread safe than un-file-mapped memory. The only real difference is that your changes are occasionally flushed to a file, and that it can be reflected in memory in another process. On another note, if you are using the mapped memory between processes, then any variables in it that are pointers are unlikely to be valid in the other process. So a queue may be dangerous, depending on how you've implemented it. You can get around the synchronisation problems by using named synch objects in both processes. Iain.

      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