本文整理汇总了C++中ACE_TEXT函数的典型用法代码示例。如果您正苦于以下问题:C++ ACE_TEXT函数的具体用法?C++ ACE_TEXT怎么用?C++ ACE_TEXT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ACE_TEXT函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: throw
void qlTimeSeriesDataReaderListenerImpl::on_data_available( DDS::DataReader_ptr reader )
throw (CORBA::SystemException)
{
try {
timeseries::qlTimeSeriesDataReader_var obj_dr
= timeseries::qlTimeSeriesDataReader::_narrow(reader);
if (CORBA::is_nil (obj_dr.in ())) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("(%P|%t) ERROR: ")
ACE_TEXT("qlTimeSeriesDataReaderListenerImpl::on_data_available: _narrow failed.\n")));
}
on_reading_start( reader );
int count = 0;
while ( true )
{
timeseries::qlTimeSeries obj;
DDS::SampleInfo si ;
DDS::ReturnCode_t status = obj_dr->take_next_sample(obj, si) ;
if ( status == DDS::RETCODE_OK )
{
if ( si.valid_data == true )
{
++count;
if ( pre_quantlib_addin_call( reader, si, obj ) )
{
std::string returnObject;;
try {
ACE_Guard<ACE_Mutex> guard( get_ACE_Mutex() );
returnObject = QuantLibAddinCpp::qlTimeSeries (
obj.ObjectId.in(),
qldds_utils::vector_cast<ObjectHandler::property_t,CORBA::StringSeq>(obj.Dates),
qldds_utils::vector_cast<double,CORBA::DoubleSeq>(obj.Values),
static_cast<bool>(obj.Permanent),
obj.Trigger,
static_cast<bool>(obj.Overwrite) );
;
} catch ( std::exception& e )
{
on_std_exception( reader, obj, e );
continue;
}
if ( !post_quantlib_addin_call( reader, obj, returnObject ) )
break;
}
}
} else if (status == DDS::RETCODE_NO_DATA) {
on_reading_end( reader, count );
break;
} else {
std::string err = "ERROR: read qlTimeSeries: Error: ";
err += status;
on_dds_reading_error( reader, err );
}
}
} catch (CORBA::Exception& e) {
on_dds_exception( reader, e );
}
}
开发者ID:Fantasticer,项目名称:qldds,代码行数:75,代码来源:timeseriesDataReaderListenerImpl.cpp
示例2: defined
int
ACE_Svc_Conf_Lexer::yylex (YYSTYPE* ace_yylval,
ACE_Svc_Conf_Param* param)
{
#if defined (ACE_USES_WCHAR)
bool look_for_bom = false;
ACE_Encoding_Converter_Factory::Encoding_Hint hint =
ACE_Encoding_Converter_Factory::ACE_NONE;
#endif /* ACE_USES_WCHAR */
if (param->buffer == 0)
{
#if defined (ACE_USES_WCHAR)
look_for_bom = true;
#endif /* ACE_USES_WCHAR */
ACE_NEW_RETURN (param->buffer,
ace_yy_buffer_state,
-1);
}
int token = ACE_NO_STATE;
do {
if (param->buffer->need_more_)
{
#if defined (ACE_USES_WCHAR)
size_t skip_bytes = 0;
#endif /* ACE_USES_WCHAR */
param->buffer->need_more_ = false;
size_t amount =
input (param,
param->buffer->input_ + param->buffer->size_,
normalize (ACE_YY_BUF_SIZE -
param->buffer->size_));
if (amount == 0)
{
param->buffer->eof_ = true;
#if defined (ACE_USES_WCHAR)
skip_bytes = param->buffer->size_;
#endif /* ACE_USES_WCHAR */
}
else
{
#if defined (ACE_USES_WCHAR)
if (look_for_bom)
{
size_t read_more = 0;
look_for_bom = false;
hint = locate_bom (param->buffer->input_, amount, read_more);
if (read_more != 0)
{
input (param,
param->buffer->input_ + amount,
read_more);
ACE_OS::memmove (param->buffer->input_,
param->buffer->input_ + read_more,
amount);
}
}
skip_bytes = param->buffer->size_;
#endif /* ACE_USES_WCHAR */
param->buffer->size_ += amount;
}
#if defined (ACE_USES_WCHAR)
if (!convert_to_utf8 (param, skip_bytes, hint))
{
ace_yyerror (++param->yyerrno,
param->yylineno,
ACE_TEXT ("Unable to convert input stream to UTF-8"));
return ACE_NO_STATE;
}
#endif /* ACE_USES_WCHAR */
}
token = scan (ace_yylval, param);
} while (token == ACE_NO_STATE && param->buffer->need_more_);
return token;
}
开发者ID:CCJY,项目名称:ACE,代码行数:80,代码来源:Svc_Conf_Lexer.cpp
示例3: ACE_GUARD
void
TAO::PG_Object_Group::add_member (const PortableGroup::Location & the_location,
CORBA::Object_ptr member)
{
ACE_GUARD (TAO_SYNCH_MUTEX, guard, this->internals_);
if (CORBA::is_nil (member))
{
if (TAO_debug_level > 3)
{
ORBSVCS_ERROR ((LM_ERROR,
ACE_TEXT ("%T %n (%P|%t) - TAO::PG_Object_Group::add_member")
ACE_TEXT ("Can't add a null member to object group\n")
));
}
throw PortableGroup::ObjectNotAdded ();
}
/////////////////////////////////////////
// Convert the new member to a string IOR
// This keeps a clean IOR (not an IOGR!)
// while we add it to a group. We need a
// IORs, not IOGRs to send new IOGRs out
// to replicas.
// Verify that the member is not using V1.0 profiles
// since IIOP V1.0 does not support tagged components
const TAO_MProfile &member_profiles =
member->_stubobj ()->base_profiles ();
CORBA::ULong member_profile_count =
member_profiles.profile_count ();
if (member_profile_count > 0)
{
const TAO_GIOP_Message_Version & version =
member_profiles.get_profile (0)->version ();
if (version.major_version () == 1 &&
version.minor_version () == 0)
{
if (TAO_debug_level > 3)
{
ORBSVCS_ERROR ((LM_ERROR,
ACE_TEXT ("%T %n (%P|%t) - ")
ACE_TEXT ("Can't add member because first profile ")
ACE_TEXT ("is IIOP version 1.0, which does not ")
ACE_TEXT ("support tagged components.\n")
));
}
throw PortableGroup::ObjectNotAdded ();
}
}
CORBA::String_var member_ior_string =
orb_->object_to_string (member);
PortableGroup::ObjectGroup_var new_reference;
try {
new_reference =
this->add_member_to_iogr (member);
}
catch (const TAO_IOP::Duplicate&)
{
throw PortableGroup::MemberAlreadyPresent ();
}
catch (const TAO_IOP::Invalid_IOR&)
{
throw PortableGroup::ObjectNotAdded ();
}
catch (...)
{
throw;
}
if (CORBA::is_nil (new_reference.in ()))
throw PortableGroup::ObjectNotAdded ();
// Convert new member back to a (non group) ior.
CORBA::Object_var member_ior =
this->orb_->string_to_object (member_ior_string.in ());
MemberInfo * info = 0;
ACE_NEW_THROW_EX (info,
MemberInfo (member_ior.in (),
the_location),
CORBA::NO_MEMORY());
if (this->members_.bind (the_location, info) != 0)
{
delete info;
// @@ Dale why this is a NO MEMORY exception?
throw CORBA::NO_MEMORY();
}
this->reference_ = new_reference; // note var-to-var assignment does
// a duplicate
if (this->increment_version ())
{
this->distribute_iogr ();
//.........这里部分代码省略.........
开发者ID:bjovke,项目名称:ACE_TAO,代码行数:101,代码来源:PG_Object_Group.cpp
示例4: RPG_TRACE
void
SDL_GUI_MainWindow::initScrollSpots()
{
RPG_TRACE(ACE_TEXT("SDL_GUI_MainWindow::initScrollSpots"));
// upper left
RPG_Graphics_HotSpot::initialize(*this, // parent
std::make_pair(RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN,
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN), // size
std::make_pair(0,
0), // offset
CURSOR_SCROLL_UL); // (hover) cursor graphic
// up
RPG_Graphics_HotSpot::initialize(*this, // parent
std::make_pair((clipRectangle_.w -
(2 * RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN)),
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN), // size
std::make_pair(RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN,
0), // offset
CURSOR_SCROLL_U); // (hover) cursor graphic
// upper right
RPG_Graphics_HotSpot::initialize(*this, // parent
std::make_pair(RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN,
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN), // size
std::make_pair((clipRectangle_.w -
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN),
0), // offset
CURSOR_SCROLL_UR); // (hover) cursor graphic
// left
RPG_Graphics_HotSpot::initialize(*this, // parent
std::make_pair(RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN,
(clipRectangle_.h -
(2 * RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN))), // size
std::make_pair(0,
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN), // offset
CURSOR_SCROLL_L); // (hover) cursor graphic
// right
RPG_Graphics_HotSpot::initialize(*this, // parent
std::make_pair(RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN,
(clipRectangle_.h -
(2 * RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN))), // size
std::make_pair((clipRectangle_.w -
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN),
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN), // offset
CURSOR_SCROLL_R); // (hover) cursor graphic
// lower left
RPG_Graphics_HotSpot::initialize(*this, // parent
std::make_pair(RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN,
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN), // size
std::make_pair(0,
(clipRectangle_.h -
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN)), // offset
CURSOR_SCROLL_DL); // (hover) cursor graphic
// down
RPG_Graphics_HotSpot::initialize(*this, // parent
std::make_pair(clipRectangle_.w -
(2 * RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN),
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN), // size
std::make_pair(RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN,
(clipRectangle_.h -
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN)), // offset
CURSOR_SCROLL_D); // (hover) cursor graphic
// lower right
RPG_Graphics_HotSpot::initialize(*this, // parent
std::make_pair(RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN,
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN), // size
std::make_pair((clipRectangle_.w -
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN),
(clipRectangle_.h -
RPG_GRAPHICS_WINDOW_HOTSPOT_SCROLL_MARGIN)), // offset
CURSOR_SCROLL_DR); // (hover) cursor graphic
}
开发者ID:bhutnath,项目名称:yarp,代码行数:72,代码来源:SDL_gui_mainwindow.cpp
示例5: ACE_ERROR_RETURN
int
be_visitor_operation_ch::visit_operation (be_operation *node)
{
TAO_OutStream *os = this->ctx_->stream ();
this->ctx_->node (node);
*os << be_nl_2;
// STEP I: generate the return type.
be_type *bt = be_type::narrow_from_decl (node->return_type ());
if (!bt)
{
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT ("be_visitor_operation_ch::")
ACE_TEXT ("visit_operation - ")
ACE_TEXT ("Bad return type\n")),
-1);
}
//Only if we are generating exec header file, generate DOxygen documentation
if (this->ctx_->state () == TAO_CodeGen::TAO_ROOT_EXH)
{
if (this->void_return_type (bt))
{
*os << "/// Setter for " << node->local_name() << " attribute" << be_nl
<< "/// @param[in] " << node->local_name() << " - New value for "
<< node->local_name() << " attribute" << be_nl;
}
else
{
*os << "/// Getter for " << node->local_name() << " attribute" << be_nl
<< "/// @return value of " << node->local_name() << " attribute" << be_nl;
}
}
*os << "virtual ";
// Grab the right visitor to generate the return type.
be_visitor_context ctx (*this->ctx_);
be_visitor_operation_rettype or_visitor (&ctx);
if (bt->accept (&or_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ch::"
"visit_operation - "
"codegen for return type failed\n"),
-1);
}
// STEP 2: generate the operation name. The port prefix should
// be an empty string except for operations from attributes
// defined in a porttype.
*os << " " << node->local_name ();
// STEP 3: generate the argument list with the appropriate mapping. For these
// we grab a visitor that generates the parameter listing.
ctx = *this->ctx_;
ctx.state (TAO_CodeGen::TAO_OPERATION_ARGLIST_CH);
be_visitor_operation_arglist oa_visitor (&ctx);
if (node->accept (&oa_visitor) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
"(%N:%l) be_visitor_operation_ch::"
"visit_operation - "
"codegen for argument list failed\n"),
-1);
}
be_interface *intf =
be_interface::narrow_from_scope (node->defined_in ());
/// If we are in a reply handler, are not an excep_* operation,
/// and have no native args, then generate the AMI static
/// reply stub declaration.
if (intf != 0
&& intf->is_ami_rh ()
&& !node->is_excep_ami ()
&& !node->has_native ())
{
*os << be_nl_2
<< "static void" << be_nl
<< node->local_name () << "_reply_stub (" << be_idt_nl
<< "TAO_InputCDR &_tao_reply_cdr," << be_nl
<< "::Messaging::ReplyHandler_ptr _tao_reply_handler,"
<< be_nl
<< "::CORBA::ULong reply_status);" << be_uidt;
}
return 0;
}
开发者ID:asdlei00,项目名称:ACE,代码行数:94,代码来源:operation_ch.cpp
示例6: ACE_TEXT
#include "test_config.h"
#include "Cfg.h"
#include "PSession.h"
#include "ace/INET_Addr.h"
//#include "ace/Countdown_Time.h"
#include "Asynch_RW.h"
static TestCfg cfg;
static ACE_TCHAR complete_message[] =
ACE_TEXT ("GET / HTTP/1.1\r\n")
ACE_TEXT ("Accept: */*\r\n")
ACE_TEXT ("Accept-Language: C++\r\n")
ACE_TEXT ("Accept-Encoding: gzip, deflate\r\n")
ACE_TEXT ("User-Agent: P_Test /1.0 (non-compatible)\r\n")
ACE_TEXT ("Connection: Keep-Alive\r\n")
ACE_TEXT ("\r\n");
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class TRB_Asynch_Acceptor<PSession>;
template class TRB_Asynch_Connector<PSession>;
template class TRB_Asynch_RW<TRB_Asynch_Read_Stream,TRB_Asynch_Write_Stream>;
template class TRB_Asynch_RW_Stream<TRB_Asynch_Read_Stream,TRB_Asynch_Write_Stream>;
开发者ID:binghuo365,项目名称:BaseLab,代码行数:29,代码来源:P_Test.cpp
示例7: get_name
// Virtual from PSession
virtual const ACE_TCHAR * get_name (void) const
{
return ACE_TEXT("Sender");
}
开发者ID:binghuo365,项目名称:BaseLab,代码行数:5,代码来源:P_Test.cpp
示例8: aiowait
int
ACE_SUN_Proactor::handle_events_i (ACE_Time_Value *delta)
{
int retval = 0;
aio_result_t *result = 0;
if (0 == delta)
{
if (this->num_started_aio_ == 0)
this->wait_for_start (0);
result = aiowait (0);
}
else
{
if (this->num_started_aio_ == 0)
{
// Decrement delta with the amount of time spent waiting
ACE_Countdown_Time countdown (delta);
ACE_Time_Value tv (*delta);
tv += ACE_OS::gettimeofday ();
if (this->wait_for_start (&tv) == -1)
return -1;
}
struct timeval delta_tv = *delta;
result = aiowait (&delta_tv);
}
if (result == 0)
{
// timeout, do nothing,
// we should process "post_completed" queue
}
else if (reinterpret_cast<long> (result) == -1)
{
// Check errno for EINVAL,EAGAIN,EINTR ??
switch (errno)
{
case EINTR : // aiowait() was interrupted by a signal.
case EINVAL: // there are no outstanding asynchronous I/O requests.
break; // we should process "post_completed" queue
default: // EFAULT
ACE_ERROR_RETURN ((LM_ERROR,
ACE_TEXT("%N:%l:(%P | %t)::%p \nNumAIO=%d\n"),
ACE_TEXT("ACE_SUN_Proactor::handle_events: aiowait failed"),
num_started_aio_),
-1);
}
}
else
{
int error_status = 0;
size_t transfer_count = 0;
ACE_POSIX_Asynch_Result *asynch_result =
find_completed_aio (result,
error_status,
transfer_count);
if (asynch_result != 0)
{
// Call the application code.
this->application_specific_code (asynch_result,
transfer_count,
0, // No completion key.
error_status); // Error
retval++;
}
}
// process post_completed results
retval += this->process_result_queue ();
return retval > 0 ? 1 : 0 ;
}
开发者ID:AdrElecTro,项目名称:CactusEMU,代码行数:77,代码来源:SUN_Proactor.cpp
示例9: ACE_TEXT
#include "../Scheduler.h"
#include "tao/RTScheduling/RTScheduler_Manager.h"
#include "testC.h"
#include "ace/Get_Opt.h"
#include "ace/SString.h"
ACE_TString ior = ACE_TEXT("file://test.ior");
int
parse_args (int argc,
ACE_TCHAR* argv [])
{
// Parse command line arguments
ACE_Get_Opt opts (argc, argv, ACE_TEXT("f:"));
int c;
while ((c= opts ()) != -1)
{
switch (c)
{
case 'f':
ior = ACE_TEXT("file://");
ior += opts.opt_arg ();
break;
default:
ACE_DEBUG ((LM_DEBUG, "Unknown Option\n"));
return -1;
}
}
return 0;
}
开发者ID:OspreyHub,项目名称:ATCD,代码行数:31,代码来源:test_client.cpp
示例10: ACE_REGISTRY_CALL_RETURN
// of Win32 Reg*() functions
#define ACE_REGISTRY_CALL_RETURN(X) \
do { \
if (X != ERROR_SUCCESS) \
{ \
errno = X; \
return -1; \
} \
else \
return 0; \
} while (0)
ACE_BEGIN_VERSIONED_NAMESPACE_DECL
ACE_TCHAR const ACE_Registry::STRING_SEPARATOR[] = ACE_TEXT ("\\");
bool
ACE_Registry::Name_Component::operator== (const Name_Component &rhs) const
{
return
rhs.id_ == this->id_ &&
rhs.kind_ == this->kind_;
}
bool
ACE_Registry::Name_Component::operator!= (const Name_Component &rhs) const
{
return !this->operator== (rhs);
}
开发者ID:CCJY,项目名称:ACE,代码行数:30,代码来源:Registry.cpp
示例11: search_addr
int
ACE_Bounded_Cached_Connect_Strategy<SVC_HANDLER, ACE_PEER_CONNECTOR_2, CACHING_STRATEGY, ATTRIBUTES, MUTEX>::find_or_create_svc_handler_i
(SVC_HANDLER *&sh,
const ACE_PEER_CONNECTOR_ADDR &remote_addr,
ACE_Time_Value *timeout,
const ACE_PEER_CONNECTOR_ADDR &local_addr,
bool reuse_addr,
int flags,
int perms,
ACE_Hash_Map_Entry<ACE_Refcounted_Hash_Recyclable<ACE_PEER_CONNECTOR_ADDR>,
std::pair<SVC_HANDLER *, ATTRIBUTES> > *&entry,
int &found)
{
REFCOUNTED_HASH_RECYCLABLE_ADDRESS search_addr (remote_addr);
// Try to find the address in the cache. Only if we don't find it
// do we create a new <SVC_HANDLER> and connect it with the server.
while (this->find (search_addr, entry) != -1)
{
// We found a cached svc_handler.
// Get the cached <svc_handler>
sh = entry->int_id_.first ();
// Is the connection clean?
int state_result= ACE::handle_ready (sh->peer ().get_handle (),
&ACE_Time_Value::zero,
1, // read ready
0, // write ready
1);// exception ready
if (state_result == 1)
{
// The connection was disconnected during idle.
// close the svc_handler down.
if (sh->close () == -1)
{
ACE_ASSERT (0);
return -1;
}
sh = 0;
// and rotate once more...
}
else if ((state_result == -1) && (errno == ETIME))
{
// Found!!!
// Set the flag
found = 1;
// Tell the <svc_handler> that it should prepare itself for
// being recycled.
if (this->prepare_for_recycling (sh) == -1)
{
ACE_ASSERT (0);
return -1;
}
return 0;
}
else // some other return value or error...
{
ACE_ASSERT (0); // just to see it coming
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("(%t)ACE_Bounded_Cached_Connect_Strategy<>::")
ACE_TEXT ("find_or_create_svc_handler_i - ")
ACE_TEXT ("error polling server socket state.\n")));
return -1;
}
}
// Not found...
// Set the flag
found = 0;
// Check the limit of handlers...
if ((this->max_size_ > 0) &&
(this->connection_cache_.current_size () >= this->max_size_))
{
// Try to purge idle connections
if (this->purge_connections () == -1)
return -1;
// Check limit again.
if (this->connection_cache_.current_size () >= this->max_size_)
// still too much!
return -1;
// OK, we have room now...
}
// We need to use a temporary variable here since we are not
// allowed to change <sh> because other threads may use this
// when we let go of the lock during the OS level connect.
//
// Note that making a new svc_handler, connecting remotely,
// binding to the map, and assigning of the hint and recycler
// should be atomic to the outside world.
//.........这里部分代码省略.........
开发者ID:baiyunping333,项目名称:nnt,代码行数:101,代码来源:Cached_Connect_Strategy_T.cpp
示例12: run_main
int
run_main (int argc, ACE_TCHAR *argv[])
{
#if defined (ACE_LACKS_FORK)
ACE_UNUSED_ARG (argc);
ACE_UNUSED_ARG (argv);
ACE_START_TEST (ACE_TEXT ("Process_Mutex_Test"));
ACE_ERROR ((LM_INFO,
ACE_TEXT ("fork is not supported on this platform\n")));
ACE_END_TEST;
#else /* ! ACE_LACKS_FORK */
parse_args (argc, argv);
// Child process code.
if (child_process)
{
ACE_APPEND_LOG ("Process_Mutex_Test-children");
acquire_release ();
ACE_END_LOG;
}
else
{
ACE_START_TEST (ACE_TEXT ("Process_Mutex_Test"));
ACE_INIT_LOG ("Process_Mutex_Test-children");
ACE_Process_Options options;
if (release_mutex == 0)
options.command_line (ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR
ACE_TEXT ("Process_Mutex_Test")
ACE_PLATFORM_EXE_SUFFIX
ACE_TEXT (" -c -n %s -d"),
ACE_TEXT_CHAR_TO_TCHAR (mutex_name));
else
options.command_line (ACE_TEXT (".") ACE_DIRECTORY_SEPARATOR_STR
ACE_TEXT ("Process_Mutex_Test")
ACE_PLATFORM_EXE_SUFFIX
ACE_TEXT (" -c -n %s"),
ACE_TEXT_CHAR_TO_TCHAR (mutex_name));
// Spawn <n_processes> child processes that will contend for the
// lock.
ACE_Process children[n_processes];
size_t i;
for (i = 0;
i < n_processes;
i++)
{
// Spawn the child process.
int result = children[i].spawn (options);
ACE_ASSERT (result != -1);
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Parent spawned child process with pid = %d.\n"),
children[i].getpid ()));
// Give the newly spawned child process a chance to start...
// David Levine thinks this sleep() is required because
// calling ::waitpid () before a fork'ed child has actually
// been created may be a problem on some platforms. It's
// not enough for fork() to have returned to the parent.
ACE_OS::sleep (1);
}
for (i = 0; i < n_processes; i++)
{
ACE_exitcode child_status;
// Wait for the child processes we created to exit.
ACE_ASSERT (children[i].wait (&child_status) != -1);
if (child_status == 0)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("Child %d finished ok\n"),
children[i].getpid ()));
else
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("Child %d finished with status %d\n"),
children[i].getpid (), child_status));
}
ACE_END_TEST;
}
#endif /* ! ACE_LACKS_FORK */
return 0;
}
开发者ID:BackupTheBerlios,项目名称:pyasynchio-svn,代码行数:86,代码来源:Process_Mutex_Test.cpp
示例13: wait_for_match
void
Writer::write(bool reliable, int num_messages)
{
DDS::InstanceHandleSeq handles;
try {
// Block until Subscriber is available
wait_for_match(writer1_);
wait_for_match(writer2_);
ACE_DEBUG((LM_DEBUG, ACE_TEXT("(%P|%t) Writers matched\n")));
// Write samples
Messenger::MessageDataWriter_var message_dw1
= Messenger::MessageDataWriter::_narrow(writer1_);
Messenger::MessageDataWriter_var message_dw2
= Messenger::MessageDataWriter::_narrow(writer2_);
if (CORBA::is_nil(message_dw1.in())) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" ERROR: _narrow dw1 failed!\n")));
ACE_OS::exit(-1);
}
if (CORBA::is_nil(message_dw2.in())) {
ACE_ERROR((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" ERROR: _narrow dw2 failed!\n")));
ACE_OS::exit(-1);
}
std::ostringstream pid;
pid << std::setw(5) << my_pid_;
Messenger::Message message1;
message1.writer_id = 1;
message1.from = "Comic Book Guy 1";
message1.process_id = pid.str().c_str();
message1.text = "Worst. Movie. Ever.";
message1.sample_id = 0;
Messenger::Message message2 = message1;
message2.writer_id = 2;
message2.from = "Comic Book Guy 2";
DDS::InstanceHandle_t handle1 = message_dw1->register_instance(message1);
DDS::InstanceHandle_t handle2 = message_dw2->register_instance(message2);
for (int i = 0; i < num_messages; i++) {
// Because the reader does not have infinite buffer space
if (!reliable) {
ACE_OS::sleep(ACE_Time_Value(0,100000));
}
extend_sample(message1);
for (CORBA::ULong j = 0; j < message1.data.length(); ++j) {
message1.data[j] = j % 256;
}
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("(%P|%t)%N:%l: Sending Message: process_id = %C ")
ACE_TEXT("writer_id = %d ")
ACE_TEXT("sample_id = %d ")
ACE_TEXT("extra data length = %d\n"),
message1.process_id.in(),
message1.writer_id,
message1.sample_id,
message1.data.length()));
DDS::ReturnCode_t error;
do {
error = message_dw1->write(message1, handle1);
if (error != DDS::RETCODE_OK) {
if (error == DDS::RETCODE_TIMEOUT) {
timeout_writes_++;
} else {
ACE_ERROR((LM_ERROR,
ACE_TEXT("%N:%l: svc()")
ACE_TEXT(" ERROR: write dw1 returned %d!\n"), error));
}
}
} while (error == DDS::RETCODE_TIMEOUT);
extend_sample(message2);
for (CORBA::ULong j = 0; j < message2.data.length(); ++j) {
message2.data[j] = 255 - (j % 256);
}
ACE_DEBUG((LM_DEBUG,
ACE_TEXT("(%P|%t)%N:%l: Sending Message: process_id = %C ")
ACE_TEXT("writer_id = %d ")
ACE_TEXT("sample_id = %d ")
ACE_TEXT("extra data length = %d\n"),
message2.process_id.in(),
message2.writer_id,
message2.sample_id,
message2.data.length()));
do {
error = message_dw2->write(message2, handle2);
//.........这里部分代码省略.........
开发者ID:oschwaldp-oci,项目名称:OpenDDS,代码行数:101,代码来源:Writer.cpp
示例14: ACE_TEXT
const ACE_TCHAR *
ACE_Proactor::name (void)
{
return ACE_TEXT ("ACE_Proactor");
}
开发者ID:0omega,项目名称:TrinityCore,代码行数:5,代码来源:Proactor.cpp
示例15: ACE_TEXT
// $Id: server.cpp 91825 2010-09-17 09:10:22Z johnnyw $
#include "Service.h"
#include "tao/Messaging/Messaging.h"
#include "tao/AnyTypeCode/Any.h"
#include "ace/Get_Opt.h"
#include "ace/OS_NS_stdio.h"
const ACE_TCHAR *ior_output_file = ACE_TEXT("test.ior");
int
parse_args (int argc, ACE_TCHAR *argv[])
{
ACE_Get_Opt get_opts (argc, argv, ACE_TEXT("o:"));
int c;
while ((c = get_opts ()) != -1)
switch (c)
{
case 'o':
ior_output_file = get_opts.opt_arg ();
break;
case '?':
default:
ACE_ERROR_RETURN ((LM_ERROR,
"usage: %s "
"-o <iorfile>"
"\n",
argv [0]),
-1);
开发者ID:asdlei00,项目名称:ACE,代码行数:31,代码来源:server.cpp
示例16: ACE_TRACE
int
ACE_SUN_Proactor::start_aio_i (ACE_POSIX_Asynch_Result *result)
{
ACE_TRACE ("ACE_SUN_Proactor::start_aio_i");
int ret_val;
const ACE_TCHAR *ptype;
// ****** from Sun man pages *********************
// Upon completion of the operation both aio_return and aio_errno
// are set to reflect the result of the operation.
// AIO_INPROGRESS is not a value used by the system
// so the client may detect a change in state
// by initializing aio_return to this value.
result->aio_resultp.aio_return = AIO_INPROGRESS;
result->aio_resultp.aio_errno = EINPROGRESS;
// Start IO
switch (result->aio_lio_opcode)
{
case LIO_READ :
ptype = ACE_TEXT ("read");
ret_val = aioread (result->aio_fildes,
(char *) result->aio_buf,
result->aio_nbytes,
result->aio_offset,
SEEK_SET,
&result->aio_resultp);
break;
case LIO_WRITE :
ptype = ACE_TEXT ("write");
ret_val = aiowrite (result->aio_fildes,
(char *) result->aio_buf,
result->aio_nbytes,
result->aio_offset,
SEEK_SET,
&result->aio_resultp);
break;
default:
ptype = ACE_TEXT ("?????");
ret_val = -1;
break;
}
if (ret_val == 0)
{
this->num_started_aio_++;
if (this->num_started_aio_ == 1) // wake up condition
this->condition_.broadcast ();
}
else // if (ret_val == -1)
{
if (errno == EAGAIN || errno == ENOMEM) // Defer - retry this later.
ret_val = 1;
else
ACE_ERROR ((LM_ERROR,
ACE_TEXT ("%N:%l:(%P | %t)::start_aio: aio%s %p\n"),
ptype,
ACE_TEXT ("queueing failed\n")));
}
return ret_val;
}
开发者ID:eSDK,项目名称:eSDKClient_Soultion,代码行数:65,代码来源:SUN_Proactor.cpp
示例17: ACE_TEXT
#include "orbsvcs/CosNotifyChannelAdminS.h"
#include "orbsvcs/CosNotifyCommC.h"
#include "orbsvcs/CosNamingC.h"
#include "orbsvcs/TimeBaseC.h"
#include "Notify_StructuredPushSupplier.h"
#include "goS.h"
#include "Notify_Test_Client.h"
// ******************************************************************
// Data Section
// ******************************************************************
static TAO_Notify_Tests_StructuredPushSupplier* supplier_1 = 0;
static int max_events = 20;
static const ACE_TCHAR *ior_output_file = ACE_TEXT ("supplier.ior");
static const ACE_TCHAR *notify2ior = ACE_TEXT ("notify2.ior");
// ******************************************************************
// Subroutine Section
// ******************************************************************
class sig_i : public POA_sig
{
public:
sig_i(CORBA::ORB_ptr orb)
: orb_(orb)
, started_(false)
{
}
void go ()
开发者ID:akostrikov,项目名称:ATCD,代码行数:31,代码来源:Structured_Supplier.cpp
示例18: TAO_EC_Kokyu_Scheduling
//Kokyu timeout generator?
}
#endif
return this->TAO_EC_Default_Factory::create_timeout_generator (ec);
}
TAO_EC_Scheduling_Strategy*
TAO_EC_Kokyu_Factory::create_scheduling_strategy (TAO_EC_Event_Channel_Base* ec)
{
if (this->scheduling_ == 2)
{
CORBA::Object_var tmp = ec->scheduler ();
RtecScheduler::Scheduler_var scheduler =
RtecScheduler::Scheduler::_narrow (tmp.in ());
return new TAO_EC_Kokyu_Scheduling (scheduler.in ());
}
return this->TAO_EC_Default_Factory::create_scheduling_strategy (ec);
}
TAO_END_VERSIONED_NAMESPACE_DECL
// ****************************************************************
ACE_STATIC_SVC_DEFINE (TAO_EC_Kokyu_Factory,
ACE_TEXT ("EC_Factory"),
ACE_SVC_OBJ_T,
&ACE_SVC_NAME (TAO_EC_Kokyu_Factory),
ACE_Service_Type::DELETE_THIS | ACE_Service_Type::DELETE_OBJ,
0)
ACE_FACTORY_DEFINE (TAO_RTKokyuEvent, TAO_EC_Kokyu_Factory)
开发者ID:asdlei00,项目名称:ACE,代码行数:30,代码来源:EC_Kokyu_Factory.cpp
示例19: arg_shifter
int
TAO_EC_Kokyu_Factory::init (int argc, ACE_TCHAR* argv[])
{
ACE_Arg_Shifter arg_shifter (argc, argv);
while (arg_shifter.is_anything_left ())
{
const ACE_TCHAR* arg = arg_shifter.get_current ();
if (ACE_OS::strcasecmp (arg, ACE_TEXT("-ECDispatching")) == 0)
{
arg_shifter.consume_arg ();
if (arg_shifter.is_parameter_next ())
{
const ACE_TCHAR* opt = arg_shifter.get_current ();
if (ACE_OS::strcasecmp (opt, ACE_TEXT("reactive")) == 0)
{
this->dispatching_ = 0;
}
else if (ACE_OS::strcasecmp (opt, ACE_TEXT("mt")) == 0)
{
this->dispatching_ = 1;
}
else if (ACE_OS::strcasecmp (opt, ACE_TEXT("kokyu")) == 0)
{
this->dispatching_ = 2;
}
else
{
ORBSVCS_ERROR ((LM_ERROR,
ACE_TEXT("EC_Kokyu_Factory - ")
ACE_TEXT("unsupported dispatching <%s>\n"),
opt));
}
arg_shifter.consume_arg ();
}
//if Kokyu dispatching - look for sched policy
if (this->dispatching_ == 2)
{
if (arg_shifter.is_parameter_next ())
{
const ACE_TCHAR* opt = arg_shifter.get_current ();
if (ACE_OS::strcasecmp (opt, ACE_TEXT("SCHED_FIFO")) == 0)
{
this->disp_sched_policy_ = ACE_SCHED_FIFO;
}
else if (ACE_OS::strcasecmp (opt, ACE_TEXT("SCHED_RR")) == 0)
{
this->disp_sched_policy_ = ACE_SCHED_RR;
}
else
{
this->disp_sched_policy_ = ACE_SCHED_OTHER;
}
arg_shifter.consume_arg ();
if (arg_shifter.is_parameter_next ())
{
const ACE_TCHAR* opt = arg_shifter.get_current ();
if (ACE_OS::strcasecmp (opt, ACE_TEXT("SYSTEM")) == 0)
|
请发表评论