Shared Memory Question

New Message Reply Date view Thread view Subject view Author view

Steve Woolsey (woolsr++at++inel.gov)
Mon, 19 Jul 1999 14:11:33 -0600


I have an app I am doing in C++ that is forking a motif process and
another process to calculate the movements for a number of object. I am
trying to get the location of the object to pass back to the draw
process, so I can update the pfDCS's. I have tried three different
approaches, with no success.

1. I tried putting a pfVec3 into the Shared struct.

typedef struct {
        pfPipeWindow *pw;
        pfChannel *chan;
        pfScene *scene;
        int exitFlag;
        pfDCS **objectDCS;
        pfVec3 *objectLocation;
        int numObjects;
}SharedData;

Then I tried declaring the pointer with:

Shared->objectLocation = new pfVec3[numObjects];

2. Tried declaring a pfDataPool in the main process, and then attaching
the movement process.

pfDataPool *pool;
pfVec3 *objectLocation;
.
.
.
pool = pfDataPool::create(numObjects*sizeof(pfVec3),"object_location");
objectLocation = (pfVec3*)pool->alloc(numObjects*sizeof(pfVec3), 103);
.
.
.
pfDataPool *dpool;
pfVec3 *objLocation;
if((fpid = fork()) < 0)
    pfNotify(PFNFY_FATAL, PFNFY_SYSERR, "Fork of robot process
failed!");
else
{
    if(fpid)
    pfNotify(PFNFY_NOTICE, PFNFY_PRINT,
        "Robots running in forked process: %d", fpid);
}
if(!fpid)
{
    dpool = pfDataPool::attach("object_location");
    objLocation =(pfVec3*) pool->find(103);
    if(dpool == NULL)
        pfNotify(PFNFY_NOTICE, PFNFY_PRINT,
            "Couldn't attach to pfDataPool in movement process!");
.
.
.
}

Niether method works. Anyone have any suggestions of what will work?

I have seen some discussion about pfData pools over the past couple of
days, that prompted me to use the pfDataPool with no success. Any help
would be greatly appreciated.

Thanks,

Steve
-------------------------------------------------------------------
Steven Woolsey Associate Engineer/Scientist
Lockheed Martin Idaho Technologies Visualization Engineer
Idaho National Engineering Lab. EMAIL: woolsr++at++inel.gov
P.O. Box 1625, M.S. 3605
Idaho Falls, ID 83415-3605
-------------------------------------------------------------------


New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Jul 19 1999 - 13:11:41 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.