Join Now
Quality Rating:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)
Expertise Level:
  • Currently 0.0 / 5
(0.0 / 5 - 0 votes cast)

This page was last modified 05:56, 1 October 2007.

Message Queues Example

From Forum Nokia Wiki

Message Queues Description


The following code shows the message queues usage(follows the steps involved in the above link):

#include <sys/msg.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
 
#define MSG_KEY 1000
pthread_t threadid;
 
void* MsgDSndThread(void* arg)
{
   struct msgbuf *snd = (struct msgbuf*)malloc(16);
   key_t fd;
   snd->mtype = 1;
   strcpy(snd->mtext, "message");
   fd = msgget(MSG_KEY, IPC_CREAT);
   msgsnd(fd, snd, 12, 0);
   free(snd);
   return 0;
}
 
void CreateThreadL()
   {
   pthread_create(&threadid,(pthread_attr_t *)NULL,MsgDSndThread, NULL);
   }
 
int main()
{
   struct msgbuf *rcv = (struct msgbuf*)malloc(16);
   key_t fd = msgget(MSG_KEY, IPC_CREAT);
   CreateThreadL();
   msgrcv(fd, rcv, 6, 0, 0);
   msgctl(fd, IPC_RMID, NULL);
   free(rcv);
   return 0;
}
Related Discussions
Thread Thread Starter Forum Replies Last Post
How I can remowe sound "inbox message" in Nokia 9300 (S80) Lehin Symbian Networking & Messaging 7 2006-12-04 10:56
Transfering text message using Bluetooth Amilael General Symbian C++ 2 2006-07-06 11:47
Customizing TGW notification SMS ask_expert General Messaging 1 2002-06-18 15:34
Question Regarding Message Class asheynkman General Messaging 0 2003-06-02 19:57
How to invoke gui in a dll wappydev Symbian User Interface 3 2003-12-15 09:27
 
Powered by MediaWiki