Thread

Callback Timings? (Sdk)

Callback Timings? // Sdk

1  |  

strike rapier

Jul 4, 2005, 3:21pm
To ask a question:

Are callbacks guarentee'd to be recieved in the same order that they were
sent FIFO, for example

Add 1
Add 2
Add 3

Callback 1
Callback 2
Callback 3

Cheers

--
- Mark Randall
http://zetech.swehli.com

magine

Jul 4, 2005, 3:32pm
I would think not, since it would depend on how long each called
function takes to finish.

[View Quote]

strike rapier

Jul 4, 2005, 3:38pm
I am making a queue system for my object events, that uses function pointers
to inform different sections about things.

I am just using FIFO at the moment, i may have to change over to the object
number method.

--
- Mark Randall
http://zetech.swehli.com

[View Quote]

xelag

Jul 5, 2005, 2:51pm
Mark, I use the object number method (combined with X Z coordinates)
to identify the object in question, and don't rely on the FIFO method
for this. For object_add and object_load, the object number should
suffice becaused it has been issued locally by the SDK. For
object_delete, it is safer to to use three parameters: object number,
X and Z.

For some other callbacks (citizen_by_number for example), I wait for
the callback before issuing another query, so FIFO does not apply
either.

For some operations you MUST wait for the callback before re-issuing,
for example, cell_next. In this case, the information is sent
serially, you rely on the data in the callback to decide whether to
re-issue cell_next or not, etc.

FIFO may be valid for some same-operation calls, seems logical, but
this is not documented nor garanteed.

Alex

On 4 Jul 2005 13:38:01 -0400, "Strike Rapier" <markyr at gmail.com>
[View Quote] >I am making a queue system for my object events, that uses function pointers
>to inform different sections about things.
>
>I am just using FIFO at the moment, i may have to change over to the object
>number method.

strike rapier

Jul 5, 2005, 3:16pm
[View Quote] > Alex

I have never really done this, I have always sent 9 or 10 at once with
aw_cell_combine on, waiting for 8 or so to be returned, then called another
10 - in my experience this improves performance by several hundred percent,
and let the callback determine if I send the next volly, obviously after the
first RC you stop - if you send a few more it doesnt really matter.

--
- Mark Randall
http://zetech.swehli.com

chrispeg

Jul 5, 2005, 7:41pm
Mark, I have to correct you here.

aw_cell_next is an enumaration through cells and uses an iterator; this
iterator is not increased before the callback returned.

So, if you ever had a closer look to the result you got back, you see that
you got the cell same 10 times, unless you set the AW_CELL_ITERATOR to a
right value before you issue an call to aw_cell_next ();

If you do not use AW_CALLBACK_CELL_RESULT, just look at the example at the
SDK help pages. If you use the callback, issue subsequent aw_cell_next ()
calls from there, as it is where you first get the new enumerated iterator.

Thanks and good luck,
Chris

"Strike Rapier" <markyr at gmail.com> schrieb im Newsbeitrag
news:42cac05e$1 at server1.Activeworlds.com...
[View Quote]

strike rapier

Jul 5, 2005, 8:47pm
[View Quote] > So, if you ever had a closer look to the result you got back, you see that
> you got the cell same 10 times, unless you set the AW_CELL_ITERATOR to a
> right value before you issue an call to aw_cell_next ();

^^ Correct, took it out of Demeter.

> Thanks and good luck,
> Chris

--
- Mark Randall
http://zetech.swehli.com

strike rapier

Jul 5, 2005, 8:59pm
That said,

I made this very mistake quite a lot a few years back until someone shouted
at me repeatedly for it and educated me to it.

It really needs adding to the documentation as this has wrecked various
projects in the past. That said, I still recieved huge increases when
automatically incrementing the itterator each time and calling in a for
loop.

--
- Mark Randall
http://zetech.swehli.com

[View Quote]

chrispeg

Jul 5, 2005, 9:12pm
http://dictionary.reference.com/search?q=iterator

iterator

<programming> An object or routine for accessing items
from a list, array or stream one at a time.

By extension, the term can be used for an object or routine
for accesing items from any data structure that can be viewed
as a list. For example, a traverser is an iterator for
tree-shaped data structures.

Note, ONE at a time ;-)

Chris


"chrispeg" <chris at activeworlds.com> schrieb im Newsbeitrag
news:42cafea1$1 at server1.Activeworlds.com...
> Mark, I have to correct you here.
>
> aw_cell_next is an enumaration through cells and uses an iterator; this
> iterator is not increased before the callback returned.
>
> So, if you ever had a closer look to the result you got back, you see that
> you got the cell same 10 times, unless you set the AW_CELL_ITERATOR to a
> right value before you issue an call to aw_cell_next ();
>
> If you do not use AW_CALLBACK_CELL_RESULT, just look at the example at the
> SDK help pages. If you use the callback, issue subsequent aw_cell_next ()
> calls from there, as it is where you first get the new enumerated
> iterator.
>
> Thanks and good luck,
> Chris
>
> "Strike Rapier" <markyr at gmail.com> schrieb im Newsbeitrag
> news:42cac05e$1 at server1.Activeworlds.com...
>
>

strike rapier

Jul 5, 2005, 10:28pm
Now consider it as the callback system is described in the AWSDK.

Each call is a request for the server to send back data for the given cell
in an asyncronous manner, which via dispatch it exactly how an itterator
works.

loop
{request multiple itens something}


> recieve the results of them

As the dictionary reference says, accessing one at a time - in this context
with a callback that would clearly indicate accessing it in order to send
the request - not to actually handle the data itself which is explicitly
dissassociated with the call itself due to the asyncronous nature..

At the end of the day: There should be an explicit aw_cell_at(x, z)
function.

--
- Mark Randall
http://zetech.swehli.com

[View Quote]

chrispeg

Jul 6, 2005, 9:09am
Not in this case, where objects data are received before the object result
comes in. The object result will iterate to the next available cell.

Chris


"Strike Rapier" <markyr at gmail.com> schrieb im Newsbeitrag
news:42cb25ac at server1.Activeworlds.com...
> Now consider it as the callback system is described in the AWSDK.
>
> Each call is a request for the server to send back data for the given cell
> in an asyncronous manner, which via dispatch it exactly how an itterator
> works.
>
> loop
> {request multiple itens something}
>
>
>
> As the dictionary reference says, accessing one at a time - in this
> context with a callback that would clearly indicate accessing it in order
> to send the request - not to actually handle the data itself which is
> explicitly dissassociated with the call itself due to the asyncronous
> nature..
>
> At the end of the day: There should be an explicit aw_cell_at(x, z)
> function.
>
> --
> - Mark Randall
> http://zetech.swehli.com
>
[View Quote]

1  |  
Awportals.com is a privately held community resource website dedicated to Active Worlds.
Copyright (c) Mark Randall 2006 - 2024. All Rights Reserved.
Awportals.com   ·   ProLibraries Live   ·   Twitter   ·   LinkedIn