Qusetion related to shared memory

This is a discussion on Qusetion related to shared memory within the C Programming forums, part of the General Programming Boards category; Good morning, I want to allocate memory by using shmget,I want this memory to consist of 4 integers and three ...

  1. #1
    g_p
    g_p is offline
    Registered User
    Join Date
    Dec 2006
    Posts
    85

    Qusetion related to shared memory

    Good morning,

    I want to allocate memory by using shmget,I want this memory to consist of 4 integers and three semaphores(type sem_t) which are going to have access to the same buffer.

    How can ido that?

    Thanks, in advance!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,494
    Create a struct containing those items, then allocate sizeof(struct) amount of shared memory.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Share segment
    By ch4 in forum C Programming
    Replies: 7
    Last Post: 12-30-2008, 01:19 AM
  2. RE: client/server shared memory problem
    By hampycalc in forum C Programming
    Replies: 0
    Last Post: 03-10-2006, 01:26 PM
  3. shared memory can not read value over 255
    By jbsloan in forum C Programming
    Replies: 4
    Last Post: 04-03-2005, 11:56 AM
  4. Managing shared memory lookups
    By clancyPC in forum Linux Programming
    Replies: 0
    Last Post: 10-08-2003, 04:44 AM
  5. Shared memory in Linux: B-TREE of structures
    By zahid in forum Linux Programming
    Replies: 3
    Last Post: 01-26-2002, 10:15 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21