Hello !
The situation looks like bellow :
Class A has a method 'start()', that method creates thread which creates
some Sequence. That sequence is passed as a 'pushPacket(Sequence xxx)'
function's parameter called on some other object (bellow is code)
//************** start() ******************
void Devices::R3505::RadioFM::RadioFM::start()
{
CORBA::String_var tmpStr =
CORBA::string_dup("RadioFMToAudioProcessor");
CORBA::Object_var tmpObj = tmpUsesDataPort->getConnections(tmpStr);
tmpAudioSimplePacket =
Devices::PC::AudioOut::AudioAPI::AudioSimplePacket::_narrow(tmpObj);
int tmpRet;
tmpRet = pthread_create( &tmpThread, NULL, packetGeneratorThread,
(void*) tmpAudioSimplePacket);
if (tmpRet!=0)
{
//throw
cout<<"Start ERROR!"<<endl;
}
}
//************** packetGeneratorThread() ******************
void* Devices::R3505::RadioFM::RadioFM::packetGeneratorThread(void*
newAudioSimplePacket)
{
Devices::PC::AudioOut::AudioAPI::AudioSimplePacket_ptr
xxxAudioSimplePacket =
(Devices::PC::AudioOut::AudioAPI::AudioSimplePacket_ptr)newAudioSimplePacket;
Devices::PC::AudioOut::AudioAPI::AudioSamples_var tmpAudioPacket;
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS,NULL);
char buf[8008];
CORBA::UShort tmpSamplesQuantity;
char sinusik[44] = {0,1,............,43};
for (int i=0; i<182; i++)
{
for (int j=0; j<44; j++)
{
buf[(i*44)+j]=sinusik[j];
}
}
tmpSamplesQuantity=8008;
CORBA::Octet* tmpSamples =
Devices::PC::AudioOut::AudioAPI::AudioSamples::allocbuf(tmpSamplesQuantity);
for (int i=0; i<8008; i++)
{
tmpSamples[i]=buf[i];
}
tmpAudioPacket = new
Devices::PC::AudioOut::AudioAPI::AudioSamples(tmpSamplesQuantity,
tmpSamplesQuantity, tmpSamples, TRUE);
while (true)
{
xxxAudioSimplePacket->pushPacket(tmpSamplesQuantity,
tmpAudioPacket);
}
}
As you can see, the thread should work in infinite loop. The only way to
stop the thread is to call 'stop()' method on class A.
Unfortunately, after call to method start() there is only one packet sent
and the inter-object communication fails.
Running this programm with "-ORBDebug All" give something like this :
IIOPProxy::add_invoke: rec=0x8075160, id=0x807b7f8, msgid=36)
Out Data 47 49 4f 50 01 00 01 00 88 1f 00 00 00 00 00 00
GIOP............
33 00 00 00 01 00 00 00 14 00 00 00 2f 31 31 38
$.........../118
32 39 2f 31 31 32 38 33 33 31 35 35 34 2f 5f 30
29/1128331554/_0
0b 00 00 00 70 75 73 68 50 61 63 6b 65 74 00 00
....pushPacket..
...
a5 9b 92 8c 89 88 89 8c 92 9a a5 b1 be cd dd ee
Ľ.....ĽąžÍÝî
00 11 21 31 40 4e 5a 64 6d 73 76 77 76 73 6d 65 [EMAIL
PROTECTED]
5a 4e 41 31 21 11 00 ef de ce bf b1 a5 9b 92 8c
ZNA1!..ďŢÎżąĽ.
89 88 89 8c 92 9a a5 b1 be cd dd ee 00 11 21 31
....ĽąžÍÝî..!1
40 4e 5a 64 6d 73 76 77 76 73 6d 65 5a 4e 41 31
@NZdmsvwvsmeZNA1
21 11 00 ef de ce bf b1 a5 9b 92 8c 89 88 89 8c
!..ďŢÎżąĽ.....
92 9a a5 b1 be cd dd ee 00 11 21 31 40 4e 5a 64 [EMAIL
PROTECTED]
6d 73 76 77 76 73 6d 65 5a 4e 41 31 21 11 00 ef
msvwvsmeZNA1!..ď
de ce bf b1 a5 9b 92 8c 89 88 89 8c 92 9a a5 b1
ŢÎżąĽ.....Ľą
be cd dd ee žÍÝî
ORB::wait for 0x807b7f8
In Data 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00
....$...........
00 00 00 00 00 00 00 00 ........
IIOP: incoming data from inet:rad133.radmor.com.pl:34165
GIOP: cannot decode incoming header from inet:rad133.radmor.com.pl:34165
Out Data 47 49 4f 50 01 00 01 06 00 00 00 00 GIOP........
GIOPCodec::~GIOPCodec: 0x808b180
pure virtual method called
The same code but without thread work correctly under QNX, and corretly
(with thread) under linux (Slackware current && gcc-3.3.6).
Has anyone some idea what happend ??
The code was compilled with : mico2.3.11 (without MT), QNX6.3.0, platform
x86, qccV3.3.1,gpp_ntox86_gcc
Thanks for help !
--
Rafal Kosiuk
RADMOR S.A.
ul. Hutnicza 3, 81-212 Gdynia
Poland
+48 58 6996749 [EMAIL PROTECTED]
_______________________________________________
Mico-devel mailing list
[email protected]
http://www.mico.org/mailman/listinfo/mico-devel