Hello,
I believe this is the way it already functions. When you create a
connection, it spawns the parser thread (which is separate from the main
thread at that point) and your callbacks are called within the context of
the parser thread. Nothing in the parser thread should be blocking your
main thread--however if a callback blocks when it is called, the parser
thread is effectively hung until the callback returns. This is why I
normally have my callbacks creating new threads so there is zero blockage of
the parser thread.
Thanks for the reply. But I am not sure if I follow. In pretty much
all the examples for xmpp4r, the main thread is put to sleep using
Thread.stop, and only then the callbacks work as expected, otherwise
the process shuts down. Can you give me snippets/examples to
illustrate your point ? Also if it helps in anyway, I put up the
question on stack overflow as well, yesterday:
http://stackoverflow.com/questions/6931096/scheduling-threads-without-stopping-one