MCPcopy Create free account
hub / github.com/OpenDDS/OpenDDS / svc

Method svc

tests/DCPS/Serializer_wstring/Writer.cpp:52–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50
51
52int
53Writer::svc ()
54{
55 ACE_DEBUG((LM_DEBUG,
56 ACE_TEXT("(%P|%t) Writer::svc begins.\n")));
57
58 ::DDS::InstanceHandleSeq handles;
59 try {
60
61 while (1)
62 {
63 writer_->get_matched_subscriptions(handles);
64 if (handles.length() > 0)
65 break;
66 else
67 ACE_OS::sleep(ACE_Time_Value(0,200000));
68 }
69
70 MessageDataWriter_var message_dw
71 = MessageDataWriter::_narrow(writer_.in());
72 if (CORBA::is_nil (message_dw.in ())) {
73 cerr << "Data Writer could not be narrowed"<< endl;
74 exit(1);
75 }
76
77 Messenger::Message message;
78 message.subject_id = 99;
79 message.wch = L'\0';
80 ::DDS::InstanceHandle_t handle = message_dw->register_instance (message);
81
82 ACE_DEBUG((LM_DEBUG,
83 ACE_TEXT("(%P|%t) %T Writer::svc starting to write.\n")));
84 for (int i = 0; i< num_messages; i ++) {
85 set_message (message, i);
86 ::DDS::ReturnCode_t ret = message_dw->write(message, handle);
87
88 if (ret != ::DDS::RETCODE_OK) {
89 ACE_ERROR ((LM_ERROR,
90 ACE_TEXT("(%P|%t) ERROR: Writer::svc, ")
91 ACE_TEXT ("%dth write() returned %d.\n"),
92 i, ret));
93 if (ret == ::DDS::RETCODE_TIMEOUT) {
94 timeout_writes_ ++;
95 }
96 }
97 }
98 } catch (CORBA::Exception& e) {
99 cerr << "Exception caught in svc:" << endl << e << endl;
100 }
101
102 while (1)
103 {
104 writer_->get_matched_subscriptions(handles);
105 if (handles.length() == 0)
106 break;
107 else
108 ACE_OS::sleep(1);
109 }

Callers

nothing calls this directly

Calls 5

lengthMethod · 0.45
inMethod · 0.45
register_instanceMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected