Subj : Re: Queues vs. Sockets
To   : X V Lxxix
From : Digital Man
Date : Thu Jun 19 2008 05:37 pm

 Re: Re: Queues vs. Sockets
 By: Digital Man to X V Lxxix on Thu Jun 19 2008 01:02 pm

>   Re: Re: Queues vs. Sockets
>   By: X V Lxxix to Digital Man on Thu Jun 19 2008 12:46 pm
>
>  >  > Both (either one) of these fixes forces the Queue destructor to be
>  >  > called at the end of the script which is responsible for detaching
>  >  > the node thread from the Queue and removing the Queue from the
>  >  > named-queue list.
>  >
>  > that worked. I think part of the problem was that to make the queue
>  > communications work for more than 2 people, I had to create more than
>  > one queue, and consequently each participating user had to create a
>  > local instance of each named queue.
>  >
>  > It made things a lot harder to clean up. Since you have a local instance
>  > of every user's queue, you can't rely on the queue's existence to
>  > determine if the user is still present. so I had to make an exiting user
>  > broadcast on a named "quit" channel so that listening connections would
>  > know the person has left, and both would have to delete their instance
>  > of the queue.
>  >
>  > Somewhere in that nonsense things did not work.
>
> Glad it's working for you now. In general, it's good practice to use 'var'
> to define variables as the scope is then specified (not global) and you'll
> have better garbage collection.

BTW, I realize it's probably not clear from the documentation
(http://synchro.net/docs/jsobjs.html#Queue), but the "value" argument to the
Queue.write() method can be any of several JS value types: bool, string,
number, null, *even* an object (with properties of any of these types,
including nested objects).

This may help in passing complex state information between threads (nodes)
without requiring complex string parsing.

                                      digital man (xbox-live: digitlman)

Snapple "Real Fact" #76:
The average person spends 2 years on the phone in his/her lifetime.
Norco, CA WX: 64.2�F, 67% humidity, 0 mph SE wind, 0.00 inches rain/24hrs

---
� Synchronet � Vertrauen � Home of Synchronet � telnet://vert.synchro.net