-
Fork ()
Any chance to use fork() (or something similar) in windows ?
I want to run parts of a code in the same time (something like parallel simulation) but i have a problem using c
If not, it won't be a problem in unix , right ?
It is much easier to use perl to do it, but i still have to use c
if anyone knows please post a reply
thank you
-
There is not a true fork() as such in Win32, but you can, of course, run more than one thread at a time in your application, (damn TeleDanmark - if my broadband had been installed in September when they said it would, my multithreading tutorials would be online by now!!!).
Look up the _beginthread() API routine in the help or at MSDN.
fork() is a POSIX compliant routine, so any POSIX compliant UNIX will support it, (and probably most non POSIX implementations as well).
-
>>It is much easier to use perl to do it, but i still have to use c
Problem solved, embed the perl code in your C program. That way you have access to perl's fork subroutine, which works in Windows.
http://www.perldoc.com/perl5.8.0/pod/perlembed.html
Otherwise you have to use threads.
-
Wouldn't the Perl fork() translate to initiation of another thread under Win32 anyway?