pid_t or Q_PID?

Simon Hausmann hausmann at kde.org
Thu Jun 14 07:17:15 BST 2007


On Thursday 14 June 2007 07:54:58 Thiago Macieira wrote:
> Christian Ehrlicher wrote:
> >Hi,
> >
> >while porting krun from k3process -> kprocess I hit the problem then
> >QProcess is using Q_PID instead pid_t. Therefore my question - what to
> >use in the interface of krun?
>
> Portable code shouldn't have to know the PID. Q_PID is a handle on
> Windows, AFAIR.

Unfortunately QProcess::pid() on Windows returns a pointer to a 
PROCESS_INFORMATION structure that is owned by QProcess while on the other 
platforms it returns a plain qint64.

My preferred option is to change the return type of KRun::run() to return void 
and remove the pid as out argument from KToolInvocation instead using pid_t. 
But if that is no option then I suggest to change it to return a qint64 and 
have an #ifdef in the implementation:

#if defined(Q_OS_WIN)
    return process->pid()->dwProcessId;
#else
    return process->pid();
#endif


Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20070614/084e359d/attachment.sig>


More information about the kde-core-devel mailing list