Fork ()

This is a discussion on Fork () within the Windows Programming forums, part of the Platform Specific Boards category; Any chance to use fork() (or something similar) in windows ? I want to run parts of a code in ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    1

    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
    Last edited by bladex; 01-14-2003 at 10:46 AM.

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    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).
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    Registered User Cela's Avatar
    Join Date
    Jan 2003
    Posts
    362
    >>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.
    *Cela*

  4. #4
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,263
    Wouldn't the Perl fork() translate to initiation of another thread under Win32 anyway?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Fork(), pause(), and storing PID's in a linked list
    By vital101 in forum C Programming
    Replies: 10
    Last Post: 09-28-2007, 02:16 AM
  2. Fork() not working.
    By BENCHMARKMAN in forum C++ Programming
    Replies: 3
    Last Post: 08-01-2007, 12:28 AM
  3. Fork - unpredictable?
    By fredkwok in forum Linux Programming
    Replies: 4
    Last Post: 03-26-2006, 01:49 PM
  4. fork(), exit() - few questions!
    By s3t3c in forum C Programming
    Replies: 10
    Last Post: 11-30-2004, 05:58 AM
  5. Daemon programming: allocated memory vs. fork()
    By twisgabak in forum Linux Programming
    Replies: 2
    Last Post: 09-25-2003, 02:53 PM

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