Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!rpi!uupsi!sunic!kth.se!cyklop.nada.kth.se!samuel From: samuel@nada.kth.se (Samuel Cederlind) Newsgroups: comp.os.mach Subject: Threads and fork() on the NeXT Summary: Forking threads after forking tasks Keywords: NeXT, thread Message-ID: <1990Sep15.221401.25887@nada.kth.se> Date: 15 Sep 90 22:14:01 GMT Sender: Samuel Cederlund, samuel@nada.kth.se Organization: Royal Institute of Technology, Stockholm, Sweden Lines: 20 (This question also posed to comp.sys.next) How come forking C-threads on the NeXT does not work after having done a unix fork() call? As I ported the public domain XScheme to our NeXT, I made an object extension to it, originally because we wanted to build an adventure game. Using the Mach operating system, objects can communicate nicely with- out knowing the borders of their tasks. It would then be very convenient if objects could be "forked off" into new processes. There is a function in the NeXT Reference Manual, task_create(), very briefly documented. In the Mach manuals it says: > Note: Not implemented yet. Use fork. So I have. There are three or so threads that always need to be running for the communication between objects. After a fork(), you have to create all threads anew, right? Anyway, there I'm stuck. This seems an insoluble problem. cthread_fork() yields an error, and sticks. Is there any reason why this should be?