[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: plugins and threads
Hi peter,
yea i looked at that, it looks like it would do the job, with a bit of rewrite of my plugin (which isnt too much of a problem).
A little suggestion would be to all plugin commands automatially in a thread or to provide a way of creating a socket thru xchat or something similar. I would presume that both would need a fair amount of changes to the code to make it thread safe tho. Just a little thought :P
with regards to mine, is there a way i can register a global variable to say that the plugin's being used so that if they call it and and then call it again, the new "thread" will check it and fail to run? i suppose i could probably create a semafore, but that would probably bring up a new bag of nigglers :P
regards
charles
On Mon, 28 Apr 2003 18:35:37 +1000
Peter Zelezny <zed@xchat.org> wrote:
> On Mon, 28 Apr 2003 09:07:30 +0100
> Charles Blackburn <charlesb@summerfield-technology.co.uk> wrote:
>
> > I have written a plugin that queries a server over a standard tcp
> > socket, however...
> >
> > the problem is that the server is usually slow to respond to the
> > commands that the plugin sends it, hence xchat is "frozen" (ie can't
> > type anything else) until the plugin finishes.
<CUT> Lookup xchat_hook_fd() in the docs, that'll give you non-blocking IO
> callbacks.
>
> You could use threads too, but it's nothing to do with xchat, it's
> just a matter of looking up pthread on the web or something :)
> Although, xchat isn't thread-safe, so only the parent thread should
> call xchat_* functions (which means you'd probably have to use some
> kind of IPC or pipe to communicate).
--
XChat-discuss: mailing list for XChat users
Archive: http://mail.nl.linux.org/xchat-discuss/