flat assembler
Message board for the users of flat assembler.

Index > MenuetOS > IPC problem

Author
Thread Post new topic Reply to topic
compilax



Joined: 18 Feb 2004
Posts: 56
compilax
Hi. I'm working on a little X type server (and later window manager) for MenuetOS. It waits for a message, and depending on the first byte of the message, it either draws an image to the working buffer, copies the working buffer to the screen, or sends back an error code. The simple program I'm using to test it sends two messages in sequence, but it appears that only one message can be in the queue at a time, meaning that the second message doesnt get through.
Can there be more than one message in the queue? Is there some way of indicating wether a message got through?

Thanks in advance, Compilax.
Post 05 Oct 2004, 05:08
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
spideros1



Joined: 17 Jan 2004
Posts: 77
Location: Poland
spideros1
Here is C code from my libipc:

Code:
typedef struct {    volatile unsigned long lock;    unsigned long free_ptr;    char __mem[0];} ipc_hdr_t;typedef struct {    unsigned long sender_pid;    unsigned long msg_length;    char message[0];} ipc_msg_t;ipc_msg_t * ipc_receive_msg(ipc_hdr_t * hdr){ ipc_msg_t * msg, * tmp; int k,copysize; lock_msg_queue(hdr); if(!ipc_messages_avail(hdr)) {  unlock_msg_queue(hdr);  return NULL; } tmp=(ipc_msg_t *)hdr->__mem; msg=(ipc_msg_t *)malloc(tmp->msg_length+sizeof(ipc_msg_t)); if(!msg) {  unlock_msg_queue(hdr);  return NULL; } k=tmp->msg_length+8; memcpy(msg,tmp,k); hdr->free_ptr-=k; copysize=hdr->free_ptr-8; if(copysize) {  memcpy(hdr->__mem,hdr->__mem+k,copysize); } unlock_msg_queue(hdr); return msg;}    
Post 05 Oct 2004, 18:11
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.