Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

a listen question

Canen Madsen
Registered User
Join date: 2 Oct 2006
Posts: 6
11-04-2006 12:57
I have 2 objects that say something and a object listening.

The object listening will change a list with the information given to it from the objects that say something.

if the listening object listens to both objects at the exact same time and trys to change the same list at the same time will there be any error or will the list change correctly?
Newgate Ludd
Out of Chesse Error
Join date: 8 Apr 2005
Posts: 2,103
11-04-2006 13:24
The chances of them happening at exactly the same time are pretty remote, and in any case I believe that the 'first' listen event will occur and the second held in the queue until it completes before it is processed.
Raeyan Aldrich
Registered User
Join date: 14 Oct 2006
Posts: 44
11-08-2006 09:01
newgate is correct, the first listen() event will start running and the second will queue.

so object a triggers the listholder which mods the list
object b triggers the listholder while it is already modifying
listholder finishes the modifications from object a and then does the ones from object b

you should have no problems with your script
Aakanaar LaSalle
Registered User
Join date: 1 Sep 2006
Posts: 132
11-08-2006 17:28
all true, with one exception.. I doubt you're doing this, but a quick warning to those who may be thinking of trying it.

Lets say you have three objects. Object A is the server object that holds the list and objects B and C each tell object A to change the list.

If object B and C both request the index of a certain item in the list, and the server replies with the index numbers, then object B asks that index (lets say 3) be deleted just before object C asks that index (lets say 5) gets changed...

What would happen is index 3 wuold be deleted, and the item at index 5 is now at index 4, thus the request from object C would change the wrong item.

Easy way to keep this from happening, is for the Objects B and C to not use the index numbers and just tell Object A to find the item and do whatever is required, in the same llSay.

Again, I doubt anyone would setup the aforementioned setup, but just in case, I thought I would point out the error that would occur.
DoteDote Edison
Thinks Too Much
Join date: 6 Jun 2004
Posts: 790
11-08-2006 17:46
From: Aakanaar LaSalle
Easy way to keep this from happening, is for the Objects B and C to not use the index numbers and just tell Object A to find the item and do whatever is required, in the same llSay.
Another solution would be to bounce subsequent requests until the current request is completed.

In an easy to understand scenario, you have a cube which allows anyone to click the cube, and change the color via dialog... To prevent two users at once, you could bounce new touches with a "try again later" message, until the current user/dialog is ended.

In your server case, you could build 'init' and 'end' messages. ObjectB wants to communicate with ServerA, so it sends an "init" message. If ServerA is ready to handle to session, ServerA responds to ObjectB with "init", else it responds with "wait". When ObjectB is finished with ServerA, it sends an "end" message, to which ServerA responds with "end". The database wouldn't be modified during the session, commands and data would only be stored... to be executed at the 'end' of the session (to prevent incomplete transactions/modifications).