Archived
This forum has been archived. Please start a new discussion on GitHub.
Posix message queue
in Help Center
Hello, together
I am trying to construct a thread (inheritated from IceUtil::Thread ) that uses POSIX IPC, for example message queue functions, but I cannot get it run.
The code is like this for example:
class TestThread : public Ice::Util::Thread
{
public:
TestThread(string name)
: _name(name)
{}
virtual void run()
{
...
message_queue= mq_open(...);
signal_event.sigev_notify=SIGEV_SIGNAL;
signal_event.sigev_signo=SIGUSR1;
mq_notify(message_queue, &signal_event);
while(1)
{
sigtimedwait(...);
dosomething();
}
}
private:
string _name;
};
int main()
{
ThreadPtr myTester = new TestThread("notify");
ThreadControl t = myTester->start();
t.join();
return 0;
}
when I run the program, mq_notify() prompt just the SIGUSR1 name:
User signal 1
then the program exit.
My question is, can ICE support POSIX message queue functions? or is there a special way to enable that? Thanks for your help!
Y. Wang
I am trying to construct a thread (inheritated from IceUtil::Thread ) that uses POSIX IPC, for example message queue functions, but I cannot get it run.
The code is like this for example:
class TestThread : public Ice::Util::Thread
{
public:
TestThread(string name)
: _name(name)
{}
virtual void run()
{
...
message_queue= mq_open(...);
signal_event.sigev_notify=SIGEV_SIGNAL;
signal_event.sigev_signo=SIGUSR1;
mq_notify(message_queue, &signal_event);
while(1)
{
sigtimedwait(...);
dosomething();
}
}
private:
string _name;
};
int main()
{
ThreadPtr myTester = new TestThread("notify");
ThreadControl t = myTester->start();
t.join();
return 0;
}
when I run the program, mq_notify() prompt just the SIGUSR1 name:
User signal 1
then the program exit.
My question is, can ICE support POSIX message queue functions? or is there a special way to enable that? Thanks for your help!
Y. Wang
0
Comments
-
Hi Yeping,
Ice does not catch SIGUSR1, and in general, it does not interact much with signals: see http://www.zeroc.com/faq/signals.html.
It's very unlikely your problem has anything to do with using IceUtil::Thread instead of directly the underlying POSIX thread function. I'd recommend to post this question on a newsgroup or forum that deals with POSIX message queues!
Cheers,
Bernard0