IPC

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
itisiuk
Member
Member
Posts: 98
Joined: Mon Mar 24, 2008 1:46 pm

IPC

Post by itisiuk »

hi

ive developed a basic IPC with send and recievie and its been working for a while now.

its just a basic message queue with no blocking or waiting or anything, which ive tested and runs fine for about an hour
before failing. ive found that this is due to running alot of different tasks and not implementing blocking.

anyway ive did some research into how blocking would work and ive come up with this

when sending a msg, block the sender and unblock the reciever.
when receiving a msg, no blocking should occur until there is no messages left to receive.
when replying to a msg, unblock the sender.

and by the term blocking a mean stop the task from being scheduled.

is this the correct way to go about this and can anyone see any problems with this??

thanks
CodeCat
Member
Member
Posts: 158
Joined: Tue Sep 23, 2008 1:45 pm
Location: Eindhoven, Netherlands

Re: IPC

Post by CodeCat »

I'm not sure whether it's necessary to handle replies specifically. A simpler solution would be to just treat a reply as another message.
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: IPC

Post by Combuster »

I'd have a thread block not until a reply, but by applications choice either until:
a) the message has been queued to the sender
b) the message has been received by the sender
c) don't send if it would block

The idea is that not all messages need a reply. And if you do need a reply you can send a message then read a message as two separate calls.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
itisiuk
Member
Member
Posts: 98
Joined: Mon Mar 24, 2008 1:46 pm

Re: IPC

Post by itisiuk »

thanks. :D

im just trying to keep everything simple and logicall for now if what i describe works
then thatll do for me untill i understand IPC a lot better.

for now im just using the reply call to send back error messages or the result
of some operation and unblock the sender. basically like send msg call.
Post Reply