shmem.cpp
来自「一个开源的网络开发库ACE」· C++ 代码 · 共 55 行
CPP
55 行
// shmem.cpp,v 1.4 2000/11/27 17:56:44 othman Exp
#include "shmem.h"
#include "ace/Log_Msg.h"
#if ! defined (ACE_LACKS_SYSV_SHMEM)
/*
Set the available_ flag to zero & optionally initialize the buf_
area.
*/
SharedData::SharedData (int initialize)
: available_ (0)
{
if (initialize)
ACE_OS::sprintf (buf_, "UNSET\n");
}
/*
Write the process ID into the buffer. This will prove to us that
the data really is shared between the client and server.
*/
void SharedData::set (void)
{
ACE_OS::sprintf (buf_,
"My PID is (%d)\n",
ACE_OS::getpid ());
}
/*
Display the buffer to the user
*/
void SharedData::show(void)
{
ACE_DEBUG ((LM_INFO,
"(%P|%t) Shared Data text is (%s)\n",
buf_));
}
// Show flag
int SharedData::available(void)
{
return available_;
}
// Set flag
void SharedData::available(int a)
{
available_ = a;
}
#endif /* ACE_LACKS_SYSV_SHMEM */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?