in reply to Data copied with fork() -> how to access true data?
So I grabbed the fork documentation and I found out that variables and such are copied. How can I, from within the fork, access the data of the main process?
You can't!.
That's the main difference between forks and threads. Threads allow shared data access, forks do not. You can use various mechanisms to indirectly share inormation between forked processes, sockets, shared ram etc. but you cannot share direct access to the same data.
I'm confused. You say that you looked at threads, but they aren't supported on your OS/perl combination, but that fork works. What confuses me is, on Windows, fork is emulated using threads. So if fork works, then I thought that Thread should also work, but maybe not.
Update: How quickly we (I) forget. I found this whilst attempting to refresh my memory.
I've never used Perl on '98. It is possible (though it seems unlikely) that the fork emulation is enabled but not the threading?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Data copied with fork() -> how to access true data?
by muba (Priest) on Jun 01, 2004 at 19:14 UTC | |
by BrowserUk (Patriarch) on Jun 01, 2004 at 19:38 UTC | |
by muba (Priest) on Jun 01, 2004 at 19:50 UTC | |
by BrowserUk (Patriarch) on Jun 01, 2004 at 20:39 UTC | |
by muba (Priest) on Jun 01, 2004 at 21:17 UTC |