#3994: Add support for creating and interrupting process groups
---------------------------------+------------------------------------------
Reporter: hamish | Owner:
Type: proposal | Status: new
Priority: normal | Component: Compiler
Version: 6.12.1 | Keywords:
Os: Unknown/Multiple | Testcase:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
This patch introduces the following to System.Process
'''new_group'''
This Bool field is added to CreateProcess. If it is set to True the child
process will be created as the lead process in a new process group.
* Unix - calls setpgid in both the parent and the child process after
fork.
* Win32 - calls CreateProcess with the CREATE_NEW_PROCESS_GROUP set. I
also had it unset CREATE_NO_WINDOW because this seems to prevent the child
attaching to the parents console (and therefor stops interuptProcessGroup
from working).
'''interruptProcessGroup'''
This function can be used interrupt a running process group.
* Unix - calls signalProcessGroup to send sigINT
* Win32 - If the process ID is known it calls generateConsoleCtrlEvent to
send cTRL_BREAK_EVENT
== __Compatibility__ ==
__Backward Compatibility__
CreateProcess has a new field new_group which may need to be added to some
existing code. If set to False the current behaviour is preserved. As far
as I know this is the only change that could break existing code.
__Linker Errors__
I have renamed the C functions it used in order to prevent linker errors
when using this new version with the existing process package.
== __Win32 Only__ ==
On Win32 the process handle is not the same as the process ID and there is
no reliable way to convert from one to the other. I have added an
interface that allows access to the process ID, but does not change the
behaviour of the existing functions.
'''PINFO'''
Replaces PHANDLE in the ProcessHandle type.
type PINFO = (PHANDLE, Maybe Word32) -- Handle and Process ID
'''mkProcessHandleWithPID'''
Like mkProcessHandle but allows you to specify the processes ID as well.
This function is now used in the run* functions and createProcess, so the
ProcessHandle they return will contain a process ID.
'''withProcessInfo and withProcessInfo_'''
Like withProcessHandle functions but gives you access to the PINFO (not
just the PHANDLE it contains).
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/3994>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs