pid.cc #1

  • //
  • guest/
  • perforce_software/
  • p4/
  • 2014-1/
  • sys/
  • pid.cc
  • View
  • Commits
  • Open Download .zip Download (631 B)
/*
 * Copyright 1995, 1996 Perforce Software.  All rights reserved.
 *
 * This file is part of Perforce - the FAST SCM System.
 */

# define NEED_GETPID
# define NEED_SIGNAL
# include "stdhdrs.h"
# include "pid.h"

# ifdef OS_NT

int
Pid::GetID()
{
	return GetCurrentThreadId();
}

int
Pid::CheckID( int id )
{
	DWORD threadId = id;
	HANDLE threadHandle;

	threadHandle = OpenThread( THREAD_QUERY_INFORMATION, NULL,  threadId );

	if( !threadHandle )
	    return 0;

	CloseHandle( threadHandle );
	return 1;
}

# else

int
Pid::GetID()
{
	return getpid();
}

int 
Pid::CheckID( int id )
{
	return( kill( id, 0 ) == 0 );
}

# endif
# Change User Description Committed
#1 15902 Matt Attaway A second renaming that I will not obliterate as a badge of shame
//guest/perforce_software/p4/2014_1/sys/pid.cc
#1 15901 Matt Attaway Clean up code to fit modern Workshop naming standards
//guest/perforce_software/p4/2014.1/sys/pid.cc
#1 12188 Matt Attaway Move 'main' p4 into a release specific directory in prep for new releases
//guest/perforce_software/p4/sys/pid.cc
#1 9129 Matt Attaway Initial commit of the 2014.1 p4/p4api source code