digitalmars.D.learn - kill and thisProcessID
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (15/15) Jun 24 2015 I have a process that shall suspend itself using SIGTSTP or
- "Per =?UTF-8?B?Tm9yZGzDtnci?= <per.nordlow gmail.com> (3/4) Jun 24 2015 See also: Discussion at
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (4/5) Jun 24 2015 I believe the best solution is to add a new function
- =?UTF-8?B?Ik5vcmRsw7Z3Ig==?= (2/5) Jun 28 2015 PR at https://github.com/D-Programming-Language/phobos/pull/3448
- Steven Schveighoffer (4/18) Jun 24 2015 Why not use core.sys.posix.signal: kill instead? You're already
- nkpm (8/23) Jun 24 2015 in std.process, add a `kill()` overload that takes `thisPid` as
I have a process that shall suspend itself using SIGTSTP or
SIGSTOP.
My current plan is
import std.process: thisProcessID, kill, Pid;
import core.sys.posix.signal: SIGKILL, SIGSTOP, SIGTSTP;
const thisPid = thisProcessID;
// some call to kill()
but kill() needs a `Pid`
so
kill(thisPid, SIGTSTP);
fails and constructing Pid cannot be done because
kill(new Pid(thisPid), SIGTSTP);
errors as
Error: class std.process.Pid member this is not accessible
What to do?
Jun 24 2015
On Wednesday, 24 June 2015 at 11:39:51 UTC, Nordlöw wrote:What to do?See also: Discussion at http://dlang.org/library/std/process/kill.html
Jun 24 2015
On Wednesday, 24 June 2015 at 11:39:51 UTC, Nordlöw wrote:What to do?I believe the best solution is to add a new function Pid thisProcessPid() to std.process and refer to this from kill(Pid). Should I do PR?
Jun 24 2015
On Wednesday, 24 June 2015 at 11:58:37 UTC, Nordlöw wrote:
I believe the best solution is to add a new function
Pid thisProcessPid()
to std.process and refer to this from kill(Pid). Should I do PR?
PR at https://github.com/D-Programming-Language/phobos/pull/3448
Jun 28 2015
On 6/24/15 7:39 AM, "Nordlöw" wrote:
I have a process that shall suspend itself using SIGTSTP or SIGSTOP.
My current plan is
import std.process: thisProcessID, kill, Pid;
import core.sys.posix.signal: SIGKILL, SIGSTOP, SIGTSTP;
const thisPid = thisProcessID;
// some call to kill()
but kill() needs a `Pid`
so
kill(thisPid, SIGTSTP);
fails and constructing Pid cannot be done because
kill(new Pid(thisPid), SIGTSTP);
errors as
Error: class std.process.Pid member this is not accessible
What to do?
Why not use core.sys.posix.signal: kill instead? You're already
importing the module anyway.
-Steve
Jun 24 2015
On Wednesday, 24 June 2015 at 11:39:51 UTC, Nordlöw wrote:
I have a process that shall suspend itself using SIGTSTP or
SIGSTOP.
My current plan is
import std.process: thisProcessID, kill, Pid;
import core.sys.posix.signal: SIGKILL, SIGSTOP, SIGTSTP;
const thisPid = thisProcessID;
// some call to kill()
but kill() needs a `Pid`
so
kill(thisPid, SIGTSTP);
fails and constructing Pid cannot be done because
kill(new Pid(thisPid), SIGTSTP);
errors as
Error: class std.process.Pid member this is not accessible
What to do?
in std.process, add a `kill()` overload that takes `thisPid` as
argument, it will create the `Pid` as a local scoped instance and
it will call the normal `kill()` version that takes a Pid as
argument with the scoped `Pid` instance.
propose a PR for this overloaded `kill()` and wait dmd 2.068
release.
Pid is well locked BTW: private constructor, final class...
Jun 24 2015









"Per =?UTF-8?B?Tm9yZGzDtnci?= <per.nordlow gmail.com> 