本文整理匯總了C++中ACE_OS_TRACE函數的典型用法代碼示例。如果您正苦於以下問題:C++ ACE_OS_TRACE函數的具體用法?C++ ACE_OS_TRACE怎麽用?C++ ACE_OS_TRACE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了ACE_OS_TRACE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: defined
void
ace_flock_t::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_OS_TRACE ("ACE_OS::ace_flock_t::dump");
# if 0
ACELIB_DEBUG ((LM_DEBUG, ACE_BEGIN_DUMP, this));
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("handle_ = %u"), this->handle_));
# if defined (ACE_WIN32)
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nInternal = %d"),
this->overlapped_.Internal));
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nInternalHigh = %d"),
this->overlapped_.InternalHigh));
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nOffsetHigh = %d"),
this->overlapped_.OffsetHigh));
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nhEvent = %d"),
this->overlapped_.hEvent));
# else
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nl_whence = %d"),
this->lock_.l_whence));
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nl_start = %d"), this->lock_.l_start));
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nl_len = %d"), this->lock_.l_len));
ACELIB_DEBUG ((LM_DEBUG, ACE_TEXT ("\nl_type = %d"), this->lock_.l_type));
# endif /* ACE_WIN32 */
ACELIB_DEBUG ((LM_DEBUG, ACE_END_DUMP));
# endif /* 0 */
#endif /* ACE_HAS_DUMP */
}
示例2: ACE_OS_TRACE
time_t
ACE_OS::mktime (struct tm *t)
{
ACE_OS_TRACE ("ACE_OS::mktime");
# if defined (ACE_HAS_WINCE)
SYSTEMTIME t_sys;
FILETIME t_file;
t_sys.wSecond = t->tm_sec;
t_sys.wMinute = t->tm_min;
t_sys.wHour = t->tm_hour;
t_sys.wDay = t->tm_mday;
t_sys.wMonth = t->tm_mon + 1; // SYSTEMTIME is 1-indexed, tm is 0-indexed
t_sys.wYear = t->tm_year + 1900; // SYSTEMTIME is real; tm is since 1900
t_sys.wDayOfWeek = t->tm_wday; // Ignored in below function call.
if (SystemTimeToFileTime (&t_sys, &t_file) == 0)
return -1;
ACE_Time_Value tv (t_file);
return tv.sec ();
# else
# if defined (ACE_HAS_THREADS) && !defined (ACE_HAS_MT_SAFE_MKTIME)
ACE_OS_GUARD
# endif /* ACE_HAS_THREADS && ! ACE_HAS_MT_SAFE_MKTIME */
ACE_OSCALL_RETURN (ACE_STD_NAMESPACE::mktime (t), time_t, (time_t) -1);
# endif /* ACE_HAS_WINCE */
}
示例3: ACE_OS_TRACE
long
ACE_OS::num_processors (void)
{
ACE_OS_TRACE ("ACE_OS::num_processors");
#if defined (ACE_HAS_PHARLAP)
return 1;
#elif defined (ACE_WIN32)
SYSTEM_INFO sys_info;
::GetSystemInfo (&sys_info);
return sys_info.dwNumberOfProcessors;
#elif defined (ACE_HAS_VXCPULIB)
return vxCpuConfiguredGet();
#elif defined (_SC_NPROCESSORS_CONF)
return ::sysconf (_SC_NPROCESSORS_CONF);
#elif defined (ACE_HAS_SYSCTL)
int num_processors = 0;
int mib[2] = { CTL_HW, HW_NCPU };
size_t len = sizeof (num_processors);
if (::sysctl (mib, 2, &num_processors, &len, 0, 0) != -1)
return num_processors;
else
return -1;
#elif defined (__hpux)
struct pst_dynamic psd;
if (::pstat_getdynamic (&psd, sizeof (psd), (size_t) 1, 0) != -1)
return psd.psd_max_proc_cnt;
else
return -1;
#else
ACE_NOTSUP_RETURN (-1);
#endif
}
示例4: defined
ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter (
ACE_THR_FUNC user_func,
void *arg,
ACE_THR_C_FUNC entry_point,
ACE_OS_Thread_Descriptor *td
#if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
, ACE_SEH_EXCEPT_HANDLER selector
, ACE_SEH_EXCEPT_HANDLER handler
#endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
)
: user_func_ (user_func)
, arg_ (arg)
, entry_point_ (entry_point)
, thr_desc_ (td)
, ctx_ (ACE_Service_Config::current())
{
ACE_OS_TRACE ("ACE_Base_Thread_Adapter::ACE_Base_Thread_Adapter");
if (ACE_Base_Thread_Adapter::init_log_msg_hook_ != 0)
(*ACE_Base_Thread_Adapter::init_log_msg_hook_) (
this->log_msg_attributes_
# if defined (ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS)
, selector
, handler
# endif /* ACE_HAS_WIN32_STRUCTURAL_EXCEPTIONS */
);
#ifdef ACE_USES_GPROF
getitimer (ITIMER_PROF, &itimer_);
#endif // ACE_USES_GPROF
}
示例5: ACE_OS_TRACE
// Automatically kill thread on exit.
ACE_Thread_Control::~ACE_Thread_Control (void)
{
ACE_OS_TRACE ("ACE_Thread_Control::~ACE_Thread_Control");
#if defined (ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS) || defined (ACE_HAS_TSS_EMULATION) || defined (ACE_WIN32)
this->exit (this->status_, 0);
#else
this->exit (this->status_, 1);
#endif /* ACE_HAS_RECURSIVE_THR_EXIT_SEMANTICS */
}
示例6: ACE_THREAD_ADAPTER_NAME
extern "C" ACE_THR_FUNC_RETURN
ACE_THREAD_ADAPTER_NAME (void *args)
{
ACE_OS_TRACE ("ACE_THREAD_ADAPTER_NAME");
#if defined (ACE_HAS_TSS_EMULATION)
// As early as we can in the execution of the new thread, allocate
// its local TS storage. Allocate it on the stack, to save dynamic
// allocation/dealloction.
void *ts_storage[ACE_TSS_Emulation::ACE_TSS_THREAD_KEYS_MAX];
ACE_TSS_Emulation::tss_open (ts_storage);
#endif /* ACE_HAS_TSS_EMULATION */
ACE_Base_Thread_Adapter * const thread_args =
static_cast<ACE_Base_Thread_Adapter *> (args);
#ifdef ACE_USES_GPROF
setitimer (ITIMER_PROF, thread_args->timerval (), 0);
#endif // ACE_USES_GPROF
// Invoke the user-supplied function with the args.
ACE_THR_FUNC_RETURN status = thread_args->invoke ();
return status;
}
示例7: ACE_OS_TRACE
void
ACE_OS::exit (int status)
{
ACE_OS_TRACE ("ACE_OS::exit");
#if defined (ACE_HAS_NONSTATIC_OBJECT_MANAGER) && !defined (ACE_HAS_WINCE) && !defined (ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER)
// Shut down the ACE_Object_Manager, if it had registered its exit_hook.
// With ACE_HAS_NONSTATIC_OBJECT_MANAGER, the ACE_Object_Manager is
// instantiated on the main's stack. ::exit () doesn't destroy it.
if (exit_hook_)
(*exit_hook_) ();
#endif /* ACE_HAS_NONSTATIC_OBJECT_MANAGER && !ACE_HAS_WINCE && !ACE_DOESNT_INSTANTIATE_NONSTATIC_OBJECT_MANAGER */
#if !defined (ACE_HAS_WINCE)
# if defined (ACE_WIN32)
::ExitProcess ((UINT) status);
# elif defined (ACE_PSOSIM)
::u_exit (status);
# else
::exit (status);
# endif /* ACE_WIN32 */
#else
// @@ This is not exactly the same as ExitProcess. But this is the
// closest one I can get.
::TerminateProcess (::GetCurrentProcess (), status);
#endif /* ACE_HAS_WINCE */
}
示例8: ACE_OS_TRACE
int
ACE_OS::execle (const char * /* path */, const char * /* arg0 */, ...)
{
ACE_OS_TRACE ("ACE_OS::execle");
ACE_NOTSUP_RETURN (-1);
// Need to write this code.
// ACE_OSCALL_RETURN (::execve (path, argv, envp), int, -1);
}
示例9: defined
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
void
ACE_Thread_Control::dump (void) const
{
#if defined (ACE_HAS_DUMP)
ACE_OS_TRACE ("ACE_Thread_Control::dump");
#endif /* ACE_HAS_DUMP */
}
示例10: ACE_OS_TRACE
int
ACE_OS::execlp (const char * /* file */, const char * /* arg0 */, ...)
{
ACE_OS_TRACE ("ACE_OS::execlp");
#if defined (ACE_WIN32) || defined (VXWORKS)
ACE_NOTSUP_RETURN (-1);
#else
ACE_NOTSUP_RETURN (-1);
// Need to write this code.
// ACE_OSCALL_RETURN (::execvp (file, argv), int, -1);
#endif /* ACE_WIN32 */
}
示例11: ACE_OS_TRACE
FILE *
ACE_OS::fopen (const char *filename,
const ACE_TCHAR *mode)
{
ACE_OS_TRACE ("ACE_OS::fopen");
#if defined (ACE_LACKS_FOPEN)
ACE_UNUSED_ARG (filename);
ACE_UNUSED_ARG (mode);
ACE_NOTSUP_RETURN (0);
#else
int hmode = _O_TEXT;
// Let the chips fall where they may if the user passes in a NULL
// mode string. Convert to an empty mode string to prevent a
// crash.
ACE_TCHAR const empty_mode[] = ACE_TEXT ("");
if (!mode)
mode = empty_mode;
for (ACE_TCHAR const* mode_ptr = mode; *mode_ptr != 0; ++mode_ptr)
fopen_mode_to_open_mode_converter (*mode_ptr, hmode);
ACE_HANDLE const handle = ACE_OS::open (filename, hmode);
if (handle != ACE_INVALID_HANDLE)
{
hmode &= _O_TEXT | _O_RDONLY | _O_APPEND;
int const fd = ::_open_osfhandle (intptr_t (handle), hmode);
if (fd != -1)
{
# if defined (ACE_HAS_NONCONST_FDOPEN) && !defined (ACE_USES_WCHAR)
FILE * const fp = ::_fdopen (fd, const_cast<ACE_TCHAR *> (mode));
# elif defined (ACE_HAS_NONCONST_FDOPEN) && defined (ACE_USES_WCHAR)
FILE * const fp = ::_wfdopen (fd, const_cast<ACE_TCHAR *> (mode));
# elif defined (ACE_USES_WCHAR)
FILE * const fp = ::_wfdopen (fd, mode);
# else
FILE * const fp = ::fdopen (fd, mode);
# endif /* defined(ACE_HAS_NONCONST_FDOPEN) && !defined (ACE_USES_WCHAR)) */
if (fp != 0)
{
return fp;
}
::_close (fd);
}
ACE_OS::close (handle);
}
return 0;
#endif
}
示例12: tm_
// Initialize the thread controller.
ACE_Thread_Control::ACE_Thread_Control (ACE_Thread_Manager *t,
int insert)
: tm_ (t),
status_ (0)
{
ACE_OS_TRACE ("ACE_Thread_Control::ACE_Thread_Control");
if (this->tm_ != 0 && insert)
{
ACE_hthread_t t_id;
ACE_OS::thr_self (t_id);
this->tm_->insert_thr (ACE_OS::thr_self (), t_id);
}
}
示例13: ACE_OS_TRACE
ssize_t
ACE_OS::writev_emulation (ACE_HANDLE handle, const iovec *iov, int n)
{
ACE_OS_TRACE ("ACE_OS::writev_emulation");
// To avoid having to allocate a temporary buffer to which all of
// the data will be copied and then written, this implementation
// performs incremental writes.
ssize_t bytes_sent = 0;
for (int i = 0; i < n; ++i)
{
ssize_t const result =
ACE_OS::write (handle, iov[i].iov_base, iov[i].iov_len);
if (result == -1)
{
// There is a subtle difference in behaviour depending on
// whether or not any data was sent. If no data was sent,
// then always return -1. Otherwise return bytes_sent.
// This gives the caller an opportunity to keep track of
// bytes that have already been sent.
if (bytes_sent > 0)
break;
else
return -1;
}
else
{
bytes_sent += result;
// Do not continue on to the next loop iteration if the
// amount of data sent was less than the amount data given.
// This avoids a subtle problem where "holes" in the data
// stream would occur if partial sends of a given buffer in
// the iovec array occured.
# if defined (ACE_HAS_SIGNED_IOVLEN)
if (result < iov[i].iov_len)
# else
if (static_cast<size_t> (result) < iov[i].iov_len)
# endif /* ACE_HAS_SIGNED_IOVLEN */
break;
}
}
return bytes_sent;
}
示例14: ACE_OS_TRACE
ACE_TCHAR *
ACE_OS::mktemp (ACE_TCHAR *s)
{
ACE_OS_TRACE ("ACE_OS::mktemp");
if (s == 0)
// check for null template string failed!
return 0;
else
{
ACE_TCHAR *xxxxxx = ACE_OS::strstr (s, ACE_TEXT ("XXXXXX"));
if (xxxxxx == 0)
// the template string doesn't contain "XXXXXX"!
return s;
else
{
ACE_TCHAR unique_letter = ACE_TEXT ('a');
ACE_stat sb;
// Find an unused filename for this process. It is assumed
// that the user will open the file immediately after
// getting this filename back (so, yes, there is a race
// condition if multiple threads in a process use the same
// template). This appears to match the behavior of the
// SunOS 5.5 mktemp().
ACE_OS::sprintf (xxxxxx,
ACE_TEXT ("%05d%c"),
ACE_OS::getpid (),
unique_letter);
while (ACE_OS::stat (s, &sb) >= 0)
{
if (++unique_letter <= ACE_TEXT ('z'))
ACE_OS::sprintf (xxxxxx,
ACE_TEXT ("%05d%c"),
ACE_OS::getpid (),
unique_letter);
else
{
// maximum of 26 unique files per template, per process
ACE_OS::sprintf (xxxxxx, ACE_TEXT ("%s"), ACE_TEXT (""));
return s;
}
}
}
return s;
}
}
示例15: ACE_OS_TRACE
FILE *
ACE_OS::fopen (const char *filename,
const ACE_TCHAR *mode)
{
ACE_OS_TRACE ("ACE_OS::fopen");
int hmode = _O_TEXT;
for (const ACE_TCHAR *mode_ptr = mode; *mode_ptr != 0; mode_ptr++)
ACE_OS::fopen_mode_to_open_mode_converter (*mode_ptr, hmode);
ACE_HANDLE handle = ACE_OS::open (filename, hmode);
if (handle != ACE_INVALID_HANDLE)
{
# if defined (ACE_HAS_WINCE)
FILE *fp = ::_wfdopen (handle, mode);
if (fp != 0)
{
checkUnicodeFormat(fp);
return fp;
}
# else
hmode &= _O_TEXT | _O_RDONLY | _O_APPEND;
# if defined (ACE_WIN64)
int fd = _open_osfhandle (intptr_t (handle), hmode);
# else
int fd = _open_osfhandle (long (handle), hmode);
# endif /* ACE_WIN64 */
if (fd != -1)
{
# if defined (__BORLANDC__) && !defined (ACE_USES_WCHAR)
FILE *fp = ::_fdopen (fd, ACE_const_cast (char *, mode));
# elif defined (__BORLANDC__) && defined (ACE_USES_WCHAR)
FILE *fp = ::_wfdopen (fd, ACE_const_cast (wchar_t *, mode));
# elif defined (ACE_USES_WCHAR)
FILE *fp = ::_wfdopen (fd, mode);
# else
FILE *fp = ::fdopen (fd, mode);
# endif /* defined(__BORLANDC__) && !defined (ACE_USES_WCHAR)) */
if (fp != 0)
{
# if defined (ACE_USES_WCHAR)
checkUnicodeFormat(fp);
# endif // ACE_USES_WCHAR
return fp;
}
::_close (fd);
}