[RESOLVED] Questions about a sample code on shared memory.
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 15 of 22

Thread: [RESOLVED] Questions about a sample code on shared memory.

Threaded View

  1. #1
    Join Date
    Jan 2012

    [RESOLVED] Questions about a sample code on shared memory.


    I attached a sample code of shared memory that I downloaded from somewhere. However there are few things about it:

    1. Producer must be started first, o.w. consumer gives an error: "shm_open: No such file or directory". -- I want to be able to start the processes in any order.
    2. If Producer restarts, then Consumer must be restarted as well. -- That's very inconvenient, if my producer goes down then I'd have to restart Consumer as well.
    3. Consumer takes 100% of CPU time of one core. -- I think that's because Consumer is polling the buffer, can it be resolved using semaphores?

    Someone could comment how to resolve those?

    Attached Files Attached Files

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

This a Codeguru.com survey!

On-Demand Webinars (sponsored)