本文整理汇总了C++中pid函数的典型用法代码示例。如果您正苦于以下问题:C++ pid函数的具体用法?C++ pid怎么用?C++ pid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pid函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: _
Port AuthHostInstance::activate()
{
StLock<Mutex> _(*this);
if (state() != alive)
{
if ((mHostType == securityAgent)) {
if (!(session().attributes() & sessionHasGraphicAccess))
CssmError::throwMe(CSSM_ERRCODE_NO_USER_INTERACTION);
if (inDarkWake())
CssmError::throwMe(CSSM_ERRCODE_IN_DARK_WAKE);
}
fork();
switch (ServerChild::state()) {
case Child::alive:
secdebug("AuthHostInstance", "%p (pid %d) has launched", this, pid());
break;
case Child::dead:
secdebug("AuthHostInstance", "%p (pid %d) failed on startup", this, pid());
break;
default:
assert(false);
}
}
if (!ready())
CssmError::throwMe(CSSM_ERRCODE_NO_USER_INTERACTION);
return servicePort();
}
开发者ID:unofficial-opensource-apple,项目名称:Security,代码行数:30,代码来源:authhost.cpp
示例2: clear_breakpoints
//------------------------------------------------------------------------------
// Name: kill
// Desc:
//------------------------------------------------------------------------------
void DebuggerCore::kill() {
if(attached()) {
clear_breakpoints();
ptrace(PT_KILL, pid(), 0, 0);
native::waitpid(pid(), 0, WAIT_ANY);
pid_ = 0;
threads_.clear();
}
}
开发者ID:Jmdebugger,项目名称:edb-debugger,代码行数:13,代码来源:DebuggerCore.cpp
示例3: pid
EXPORT_C void RMemSpySession::GetProcessIdByThreadId( TProcessId& aPID, TThreadId aTID )
{
TPckgBuf<TProcessId> pid(aPID);
TPckgBuf<TThreadId> tid(aTID);
TIpcArgs args( &pid, &tid );
User::LeaveIfError( SendReceive( EMemSpyClientServerOpGetProcessIdByThreadId, args ) );
aPID = pid();
}
开发者ID:cdaffara,项目名称:symbiandump-os2,代码行数:9,代码来源:memspysession.cpp
示例4: _pid
/*******************************************************************************
forkcmd
*******************************************************************************/
forkcmd::forkcmd(bool wait_term) :
_pid(fork()),
_status(0),
_wait(wait_term)
{
if (pid())
{
std::cout << "Forked " << pid() << std::endl ;
PCOMN_THROW_MSG_IF(pid() < 0, std::runtime_error, "Error while forking: %s", strerror(errno)) ;
}
}
开发者ID:ymarkovitch,项目名称:libpcomn,代码行数:14,代码来源:pcomn_posix_exec.cpp
示例5: _
//
// Take a living child and cut it loose. This sets its state to abandoned
// and removes it from the child registry.
// This is one thing you can do in the destructor of your subclass to legally
// dispose of your child's process.
//
void Child::abandon()
{
StLock<Mutex> _(mChildren());
if (mState == alive) {
secdebug("unixchild", "%p (pid %d) abandoned", this, pid());
mState = abandoned;
mChildren().erase(pid());
} else {
secdebug("unixchild", "%p (pid %d) is not alive; abandon() ignored",
this, pid());
}
}
开发者ID:Apple-FOSS-Mirror,项目名称:Security,代码行数:18,代码来源:unixchild.cpp
示例6: set_group
dvl::pid_table::pid_table()
{
//register internal ids
set_group(pid().set_group(GROUP_INTERNAL), L"INTERNAL");
set_element(EMPTY, L"EMPTY");
set_element(PARSER, L"PARSER");
//register diagnostic routines
set_group(pid().set_group(GROUP_DIAGNOSTIC), L"DIAGNOSTIC");
set_element(ECHO, L"ECHO");
}
开发者ID:BabitsPaul,项目名称:dvl,代码行数:13,代码来源:pid.cpp
示例7: pid
Monitor::TreeNode*
Monitor::MonitorDataStorage::getTransportNode(
const TransportKey& key,
bool& create
)
{
TreeNode* node = 0;
TransportToTreeMap::iterator location
= this->transportToTreeMap_.find( key);
if( location == this->transportToTreeMap_.end()) {
// We are done if not creating a new node.
if( !create) return 0;
// This transport needs to be installed.
// Find the parent node, if any. It is ok to not have a parent node
// for cases of out-of-order updates. We handle that as the updates
// are actually processed.
ProcessKey pid( key.host, key.pid);
TreeNode* parent = this->getProcessNode( pid, create);
QList<QVariant> list;
QString value = QString("0x%1")
.arg( key.transport, 8, 16, QLatin1Char('0'));
list << QString( QObject::tr( "Transport")) << value;
node = new TreeNode( list, parent);
if( parent) {
parent->append( node);
}
// Install the new node.
this->transportToTreeMap_[ key] = std::make_pair( node->row(), node);
} else {
node = location->second.second;
create = false;
}
// If there have been some out-of-order reports, we may have been
// created without a parent node. We can fill in that information now
// if we can. If we created the node, we already know it has a
// parent so this will be bypassed.
if( !node->parent()) {
create = true;
ProcessKey pid( key.host, key.pid);
node->parent() = this->getProcessNode( pid, create);
}
//node->setColor(1,QColor("#ffbfbf"));
return node;
}
开发者ID:Fantasticer,项目名称:OpenDDS,代码行数:51,代码来源:MonitorDataStorage.cpp
示例8: main
int main(int argc, char **argv) {
if(argc < 5) {
std::cout << "Invalid number of args." << std::endl;
return 0;
}
auto maxPwm = atof(argv[1]);
if(maxPwm < 1.34 || maxPwm > 1.7) {
std::cout << "Max pulse width needs to be in range 1.34-1.7." << std::endl;
return 0;
}
auto pGain = atof(argv[2]);
if(pGain < 0) {
std::cout << "Proportional gain needs to be larget than zero." << std::endl;
return 0;
}
auto iGain = atof(argv[3]);
if(iGain < 0) {
std::cout << "Integral gain needs to be larget than zero." << std::endl;
return 0;
}
auto dGain = atof(argv[4]);
if(dGain < 0) {
std::cout << "Derivative gain needs to be larget than zero." << std::endl;
return 0;
}
drone<servo, pid> d(std::vector<servo>({
servo(4, 1.2, maxPwm, pins::instance().pwm),
servo(5, 1.2, maxPwm, pins::instance().pwm),
servo(6, 1.2, maxPwm, pins::instance().pwm),
servo(7, 1.2, maxPwm, pins::instance().pwm) }),
std::vector<pid>({
pid(pGain, iGain, dGain),
pid(pGain, iGain, dGain),
pid(pGain, iGain, dGain) }));
stupid = &d;
struct sigaction sigIntHandler;
sigIntHandler.sa_handler = ting;
sigemptyset(&sigIntHandler.sa_mask);
sigIntHandler.sa_flags = 0;
sigaction(SIGINT, &sigIntHandler, NULL);
d.run();
}
开发者ID:samsface,项目名称:pi,代码行数:50,代码来源:drone.cpp
示例9: assert
//
// Common kill code.
// Requires caller to hold mChildren() lock.
//
void Child::tryKill(int signal)
{
assert(mState == alive); // ... or don't bother us
secdebug("unixchild", "%p (pid %d) sending signal(%d)", this, pid(), signal);
if (::kill(pid(), signal))
switch (errno) {
case ESRCH: // someone else reaped ths child; or things are just wacky
secdebug("unixchild", "%p (pid %d) has disappeared!", this, pid());
mState = invalid;
mChildren().erase(pid());
// fall through
default:
UnixError::throwMe();
}
}
开发者ID:Apple-FOSS-Mirror,项目名称:Security,代码行数:19,代码来源:unixchild.cpp
示例10: clear_breakpoints
//------------------------------------------------------------------------------
// Name: kill
// Desc:
//------------------------------------------------------------------------------
void DebuggerCore::kill() {
if(attached()) {
clear_breakpoints();
ptrace(PTRACE_KILL, pid(), 0, 0);
// TODO: do i need to actually do this wait?
native::waitpid(pid(), 0, __WALL);
delete process_;
process_ = 0;
reset();
}
}
开发者ID:jiuzhuaxiong,项目名称:edb-debugger,代码行数:19,代码来源:DebuggerCore.cpp
示例11: syscall
//------------------------------------------------------------------------------
// Name: stop_threads
// Desc:
//------------------------------------------------------------------------------
void DebuggerCore::stop_threads() {
if(process_) {
for(auto &thread: process_->threads()) {
const edb::tid_t tid = thread->tid();
if(!waited_threads_.contains(tid)) {
if(auto thread_ptr = static_cast<PlatformThread *>(thread.get())) {
syscall(SYS_tgkill, pid(), tid, SIGSTOP);
int thread_status;
if(native::waitpid(tid, &thread_status, __WALL) > 0) {
waited_threads_.insert(tid);
thread_ptr->status_ = thread_status;
if(!WIFSTOPPED(thread_status) || WSTOPSIG(thread_status) != SIGSTOP) {
qDebug("[warning] paused thread [%d] received an event besides SIGSTOP", tid);
}
}
}
}
}
}
}
开发者ID:jiuzhuaxiong,项目名称:edb-debugger,代码行数:29,代码来源:DebuggerCore.cpp
示例12: TEST
TEST (PID, PidEquilibrates)
{
float target, Kp, Ki, Kd;
float state, dt;
int step_time, nsteps;
const float target_start = 0.f;
const float target_end = 1.f;
const float tolerance = 1e-5;
state = target = 0.f;
step_time = 20;
nsteps = 200;
dt = 0.1;
Kp = 3.f;
Ki = 2.f;
Kd = 3.f;
PidControl<float> pid(target-state, Kp, Ki, Kd);
for (int i = 0; i < nsteps; ++i) {
target = i < step_time ? target_start : target_end;
state += dt * pid.update(target-state);
// printf("%g\n", state);
}
ASSERT_LE(fabs(state - target_end), tolerance);
}
开发者ID:dimaleks,项目名称:uDeviceX,代码行数:29,代码来源:step.cpp
示例13: roll
/** Caculate the PID for the roll */
inline float roll(const float &roll) {
#ifdef PITCH_ROLL_DEBUG
Serial.print(_roll);
Serial.print(",");
#endif
return pid(P_ROLL, I_ROLL, D_ROLL, _pid_roll[0], _pid_roll[1], roll, _roll * DEG_SEC);
}
开发者ID:DroneClaw,项目名称:DroneClaw,代码行数:8,代码来源:PID.hpp
示例14: pitch
/** Caculate the PID for the pitch */
inline float pitch(const float &pitch) {
#ifdef PITCH_ROLL_DEBUG
Serial.print(_pitch);
Serial.print(",");
#endif
return pid(P_PITCH, I_PITCH, D_PITCH, _pid_pitch[0], _pid_pitch[1], pitch, _pitch * DEG_SEC);
}
开发者ID:DroneClaw,项目名称:DroneClaw,代码行数:8,代码来源:PID.hpp
示例15: yaw
/** Caculate the PID for the yaw */
inline float yaw(const float &yaw) {
#ifdef PITCH_ROLL_DEBUG
Serial.print(_yaw);
Serial.println();
#endif
return pid(P_YAW, I_YAW, D_YAW, _pid_yaw[0], _pid_yaw[1], yaw, _yaw * DEG_SEC);
}
开发者ID:DroneClaw,项目名称:DroneClaw,代码行数:8,代码来源:PID.hpp
示例16: loop
// main loop
void loop()
{
// setup (unfortunately must be done here as we cannot create a global AC_PID object)
AC_PID pid(TEST_P, TEST_I, TEST_D, TEST_IMAX * 100, TEST_FILTER, TEST_DT);
AC_HELI_PID heli_pid(TEST_P, TEST_I, TEST_D, TEST_IMAX * 100, TEST_FILTER, TEST_DT, TEST_INITIAL_FF);
uint16_t radio_in;
uint16_t radio_trim;
int16_t error;
float control_P, control_I, control_D;
// display PID gains
hal.console->printf("P %f I %f D %f imax %f\n", (float)pid.kP(), (float)pid.kI(), (float)pid.kD(), (float)pid.imax());
// capture radio trim
radio_trim = hal.rcin->read(0);
while( true ) {
radio_in = hal.rcin->read(0);
error = radio_in - radio_trim;
pid.set_input_filter_all(error);
control_P = pid.get_p();
control_I = pid.get_i();
control_D = pid.get_d();
// display pid results
hal.console->printf("radio: %d\t err: %d\t pid:%4.2f (p:%4.2f i:%4.2f d:%4.2f)\n",
(int)radio_in, (int)error,
(float)(control_P+control_I+control_D),
(float)control_P, (float)control_I, (float)control_D);
hal.scheduler->delay(50);
}
}
开发者ID:08shwang,项目名称:ardupilot,代码行数:33,代码来源:AC_PID_test.cpp
示例17: str_format
CTestInfo::CTestInfo()
{
const ::testing::TestInfo *pTestInfo =
::testing::UnitTest::GetInstance()->current_test_info();
str_format(m_aFilename, sizeof(m_aFilename), "%s.%s-%d.tmp",
pTestInfo->test_case_name(), pTestInfo->name(), pid());
}
开发者ID:BannZay,项目名称:ddnet,代码行数:7,代码来源:test.cpp
示例18: switch
bool Ipc::connect(enum Cmd code, const QObject *reciever, const char *member)
{
bool connected = false;
switch (code)
{
case CmdStatus:
connected = QObject::connect(this, SIGNAL(status()), reciever, member);
break;
case CmdStop:
connected = QObject::connect(this, SIGNAL(stop()), reciever, member);
break;
case CmdPid:
connected = QObject::connect(this, SIGNAL(pid()), reciever, member);
break;
case CmdConfigRead:
connected = QObject::connect(this, SIGNAL(configRead()), reciever, member);
break;
case CmdLogReopen:
connected = QObject::connect(this, SIGNAL(logReopen()), reciever, member);
break;
case CmdStateSave:
connected = QObject::connect(this, SIGNAL(stateSave()), reciever, member);
break;
default:;
}
if (connected && !m_cmdConnected.contains(code))
m_cmdConnected << code;
return connected;
}
开发者ID:wolandtel,项目名称:terminal,代码行数:32,代码来源:ipc.cpp
示例19: PCOMN_THROW_MSG_IF
int spawncmd::close()
{
PCOMN_THROW_MSG_IF(!pid(), std::runtime_error, "Child is already terminated") ;
PCOMN_THROW_MSG_IF(terminate() < 0, std::runtime_error, "Error terminating shell command '%s': %s", _cmd.c_str(), strerror(errno)) ;
PCOMN_THROW_MSG_IF(_status == 127, std::runtime_error, "Failure running the shell. Cannot run shell command '%s'", _cmd.c_str()) ;
return _status ;
}
开发者ID:ymarkovitch,项目名称:libpcomn,代码行数:7,代码来源:pcomn_posix_exec.cpp
示例20: regulator
void regulator( ){
// Read ADC.
readAdc( );
AdcToPercetage( );
setLED( );
// Was the line found?
if(theLineIsLost( )){
*isFindingLineValue = 1.0;
isFindingLine = true; //GPIO_SetBits(GPIOD, GPIO_Pin_14);
}else{
*isFindingLineValue = -1.0;
isFindingLine = false; //GPIO_ResetBits(GPIOD, GPIO_Pin_14);
}
// Decide upon former.
if(isFindingLine){
stopTimer++;
if(*virtualSensorValue < 0.0){ drive_turn_right(80); }
else{ drive_turn_left(90); }
}
else{
pid( );
}
}
开发者ID:akerlund,项目名称:Walknut,代码行数:27,代码来源:main.c
注:本文中的pid函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论