[plug] Scheduling and Blocking Explained

Leon Brooks leon at brooks.smileys.net
Thu May 18 17:00:27 WST 2000


Brad Campbell wrote:
> I'm not yet familiar with spawning threads, 

In C (Pascal will be very similar):

#include <unistd.h>

	int pid;
	pid = fork();
	if (pid) {
		/* I am parent, PID is child's Process ID */
	} else {
		/* I am child */
	}

...(dusts off his pascal neurons, has a stab)...

	unit unistd;

	integer pid;
	pid := fork;
	if pid <> 0 then begin
		(* I am parent, PID is child's Process ID *);
	end else begin
		(* I am child *);
	end;

...maybe. Both processes share file handles unless you say otherwise by
doing slightly more complex things. For comms as fast and frequent as
yours, learning about shared memory and/or semaphores would probably
help.

-- 
If at first you don't succeed, try a shorter bungee.



More information about the plug mailing list