tags:

views:

123

answers:

1

This code works well in Mac/Linux, but not in Windows.

import mmap
import os

map = mmap.mmap(-1, 13)
map.write("Hello world!")

pid = os.fork()

if pid == 0: # In a child process
    print 'child'
    map.seek(0)
    print map.readline()

    map.close()
else:
    print 'parent'
  • What's the equivalent function of os.fork() on Windows?
+1  A: 

Depending on your use case and whether you can use python 2.6 or not, you might be able to use the multiprocessing module.

Paul Wicks