writing and reading from files
Ethan Blanton
elb at pidgin.im
Wed Jan 21 21:49:57 EST 2009
Bron Gondwana spake unto us the following wisdom:
> On Wed, Jan 21, 2009 at 03:04:53PM -0500, Etan Reisner wrote:
> > So you are intending to block incoming messages with your handler for the
> > receiving_im_msg signal, write it to a file, have some other program read
> > the file and do something with the message, and then somehow (how
> > exactly?) have that program feed the message back into pidgin so pidgin
> > can display it?
> >
> > That sounds like it is incredibly likely to introduce somewhat substantial
> > delays into the display of incoming messages and likely to break thereby
> > removing all ability to see incoming messages to me.
> >
> > Did I miss something?
>
> Yeah, modern desktop computers are hella-fast (especially if you put
> /tmp on tmpfs or something) and fork is pretty cheap too.
This doesn't really tell the whole picture. I'm glad you're trying to
be friendly, but pointing out a poor solution as a poor solution
*before* someone does the work of implementing it is a better idea
than encouraging the poor solution.
> Compared to the delays introduced by the network (ok, so my djabberd is
> in New York, and I'm in Australia), this is nothing. Invoking a simple
> program to change the contents of a file is well under the human
> noticability threshold these days - and if your system is so heavily
> loaded that it's likely to a problem then all bets are already off -
> pidgin itself could be swapped out for an indeterminate time.
A substantial issue here (and one which will likely lead to either real
expense or nontrivial delays which are *well* within the realm of
human ken) is that detecting file changes is Hard to do well and
portably. Polling the filesystem is still the best plan out there
(some systems have better plans, but I'm not aware of multiple systems
which have the *same* better plan), and that's Expensive.
I'm not sure at all what the original poster is *really* trying to
accomplish, but communicating through files is almost certainly not
the right solution. The D-Bus API or a custom socket communication
are probably more in line.
> Bron ( so let's try being positive about people's ideas )
Ethan ( so let's try being helpful )
--
The laws that forbid the carrying of arms are laws [that have no remedy
for evils]. They disarm only those who are neither inclined nor
determined to commit crimes.
-- Cesare Beccaria, "On Crimes and Punishments", 1764
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://pidgin.im/pipermail/devel/attachments/20090121/fb25d42a/attachment.sig>
More information about the Devel
mailing list