heapsters / shelldon

Sheldon Cooper inspired shell
MIT License
0 stars 0 forks source link

representation of background/foreground jobs #1

Open olivedae opened 8 years ago

olivedae commented 8 years ago

How we going to handle these background and foreground jobs

olivedae commented 8 years ago

To distinguish between the two currently, a global variable declared as type volatile sig_atomic_t, atomic_fggpid is used as flag.

When a valid foreground job is sent, atomic_fggpid is set to that process's id otherwise it is set to 0 when no foreground job is running. Read/write operations occur on initial setup, new jobs are added in eval, all three defined handlers, and waitfg.

So far it seems to do the trick, but later in development it may cause issues such as races and preventing them.

Initially supported in ab78abff1d2b3cd125e76c4c5ace652a7a5013b1