[omniORB] "multiplexed calls" in local case?
tihomir.sokcevic@acterna.com
tihomir.sokcevic@acterna.com
Mon, 26 Nov 2001 16:46:34 +0100
Hello,
I wrote a little echo-like example to test the "multiplexed calls" ability of
omniORB4.
I got this results:
different machines -> everything works fine,
different processes on one machine -> everything works fine,
different threads in one process -> omniORB4 deadlocks!
Is this a bug or a feature (a question of speed)?
I'm using omniORB4-20011019.
Regards,
Tihomir Sokcevic
The example's source fragments:
//IDL code
interface Echo {
oneway void begin(in string mesg);
oneway void doing(in string mesg);
oneway void done(in string mesg);
};
//Client code
Echo_var echoref = Echo::_narrow(obj);
echoref->begin("1");
echoref->begin("2");
echoref->doing("1");
echoref->done("1");
echoref->doing("2");
echoref->done("2");
//Server code
omni_mutex mx;
int context= 0;
void Echo_i::begin(const char* mesg) {
while(context) {} //wait until free
omni_mutex_lock lock(mx);
context = (int) mesg[0]; //set current context
}
void Echo_i::doing(const char* mesg) {
while(context!= (int) mesg[0]) {} //wait until current context is processed
}
void Echo_i::done(const char* mesg) {
while(context!= (int) mesg[0]) {} //wait until current context is processed
omni_mutex_lock lock(mx);
context = 0; //clear current context
}