Re: exported.writes inside a hook threadlock?

Eugene <[email protected]>
Newsgroups gmane.comp.games.mud.client.lyntin
Message-ID <[email protected]>
On Mon, 12 Apr 2004 00:56:05 -0500
  [email protected] wrote:
>
>Is Lyntin expected to freeze when I perform
>exported.write_user_data in a to_user_hook?

Sure, it will hang. To be more precise, it could be 
eventually aborted due to stack overflow.

The exported.write_user_data calls engine.writeUI, which, 
in turn, spams the "to_user_hook". Then your hook catches 
the spammed call and calls the exported.write_user_data, 
which calls the engine.writeUI, which in turn, etc. etc.

To Will: is there any cause why the engine.writeUI calls 
the UI module directly, and doesn't shedule the call via 
it's event queue? At least, the client won't hang.

By the way, using the event queue would allow to remove 
all the synchronization stuff from the engine.writeUI. So, 
instead of

     self._ui_lock.acquire(1)
     try:
       exported.hook_spam("to_user_hook", {"message": 
text})
     finally:
       self._ui_lock.release()


it will be something like that:

     self._enqueue(event.SpamEvent("to_user_hook", 
{"message": text}))

and that's all.

>In load() I register...
>
>exported.hook_register("to_user_hook", handle_to_user)
>
>In handle_to_user(args) all these freeze...
>
>exported.write_message('...')
>exported.write_user_data('n')
>exported.write_user_data('n',msg.session)
>exported.write_user_data('n\n')
>exported.write_user_data('n\n',msg.session)

--
Eugene
---
Professional hosting for everyone - http://www.host.ru


-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.