slang-users mailing list

[2011 Date Index] [2011 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] fork with shared memory


Dear users of slang,

I'm want to create two processes, which exchange information. Using 
fork(), a simple test program, would look like this:

% ---------------------------------------- %
variable pid = fork();
variable test = 0;

% change variable in the child process
if (pid == 0)
{
    test = 1;
    _exit(1);
  }
vmessage("Test variable: %d", test );
% ---------------------------------------- %

Clearly, in this case no information is exchanged, as no memory is 
shared, hence the result is "0".

Now my question: Is there any possibility to do this with shared memory, 
such that the child process changes the value of the "test"-variable?
I found things like shmget() and vfork() for other programming 
languages, but I did not find any slang-function, which can solve this 
issue.


Cheers,
Thomas



[2011 date index] [2011 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]