[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: zed: When will the new PI be done?



> > Please, notice I've suggested a "long", not an "int". But the way it is
> > returned is not important. The real problem is classifying it as a
> > string. A C string is '\0' terminated. Calling it a string may suggest
> > to high level interfaces that it should be accessed as a real string,
> > and crash the application.
> 
> In the Java Native Interface, there is a function for translating a
> null-terminated C string to a Java string. It is also possible to
> construct a Java byte array and fill it with all of the characters in
> the C string, up to the null terminator, which should probably be
> dropped. Then some Java code can translate this byte array into a Java
> string in more sophisticated ways (for instance, you can specify the
> character encoding this way).
> 
> In either case, that isn't a problem for me.

Alex, I think you missed the point here. It's not about converting the
string, but *not* converting it. This channel->context list attribute we're
talking about is a pointer to a struct, flaged as a string, so you must
*not* convert it to a string, otherwise you may crash xchat.

[...]
> Uh... I've been using native threads in my Java code for quite some time

Please, notice I'm not the known python interface maintainer. I'm
working on a new interface, developed from the ground.

> now, on X-Chat 1.8.x. I put in accesses to X-Chat functions and data in
> a queue which is run several times per second in the main X-Chat thread.
> The calling thread is blocked until the queue item is handled, at which
[...]
> I suggest you consider using such a queue for your thread support, if
> X-Chat still isn't thread-safe, to avoid any synchronization problems.

I'm currently using a simple lock scheme, protecting commands from
being run out of time. I don't think this is going to be a problem, but
if this turns out to be a bad option, I'll consider your suggestion for
sure! It's nice to share ideas with other interface developers.

Thank you!

-- 
Gustavo Niemeyer

[ 2AAC 7928 0FBF 0299 5EB5  60E2 2253 B29A 6664 3A0C ]
--
XChat-discuss: mailing list for XChat users
Archive:       http://mail.nl.linux.org/xchat-discuss/