[cvsnt] Re: CVSNT reuses same PID....

Bo Berglund Bo.Berglund at system3r.se
Tue Dec 17 11:41:57 GMT 2002


-----Original Message-----
From: Tony Hoyle [mailto:tmh at nodomain.org]
Sent: den 17 december 2002 11:36
To: cvsnt at cvsnt.org
Subject: [cvsnt] Re: CVSNT reuses same PID....


>Bo Berglund wrote:

>> Now I just want to have someone tip me on how to differentiate between
>> different cvs invocations of the loginfo script. What CVSNT does is
>> start a cvs.exe process when the user sends in a commit. Then this cvs
>> process loops through all submodules and calls the loginfo script
>> repeatedly. I want to collect all of this output in a single message,
>> so I create a temp dir where I store it for a short period until the
>> last call is done. The temp dir name is derived from the PID of the
>> main cvs.exe process as retrieved via $CVSPID.

>You can't assume a PID won't be reused after the cvs.exe has terminated. 
>Under Unix the recycling takes quite a while.  It seems NT recycles
>quickly.  Your script shouldn't be assuming that the PID is unique - it is
>only guaranteed to be 'not the same as other running processes', which is
>not the same thing.  This is why commit scripts are usually combinations of
>loginfo and commitinfo - commitinfo happens after all the loginfo
>processing has completed.
>
>Tony

I was rather hoping for a longer time before reuse, but it turned out to not be the case...
So now I am trying to get hold of some info regarding the running cvs process that will be
fairly unique, like its start time in ticks or similar given that I know the PID of the
process.

And I think it is the opposite concerning the commitinfo/loginfo scripts. Commitinfo
is run before the commit is actually done and can block its execution if it finds that
some aspect of the commit is in error. cvs waits for it to complete. When cvs is done
committing all changes the loginfo script executes, so this is after the fact really.
I tried collecting my info in commitinfo at first, but that solution would only be
applicable to commits, and left tags and notifications out in the cold. So I stopped that
track.

Do you know of an API that can take a PID and get the process start time from Windows?
That would probably be sufficiently unique for my purposes.

/Bo




More information about the cvsnt mailing list