On Mon, 16 Apr 2007, Brian Mattern wrote:
> prefetch() currently sends a request to the server, and adds a 'cookie' > to the end of a queue to track this request. > > fetch() shifts a cookie off the front of the queue, and blocks until > a matching response has been received, placing the reply in a global > variable > > get() reads the global var populated by _fetch() and returns the actual > data we want > > > This requires a few things that aren't obvious from the api. > > A) fetch() and get() must be called in pairs. if you fetch() twice, you > lose the reply from the first. e.g. you must do (assuming the requisite > prefetches() have already been called): > > prop1_fetch(); > prop1_get(); > prop2_fetch(); > prop2_get(); > > The following will not work: > prop1_fetch(); > prop2_fetch(); > prop1_get(); > prop2_get(); > (both get() calls will use the reply from prop2_fetch()) Yes, that last one will not work, and it is in purpose. The reason : when you ask for a reply, you want to use the informations returned by the X server. So there is absolutely no interest in calling _fetch if you don't plan to use the corresponding _get just after. more precisely, the code would be: _prefetch1() _prefetch2() some code _fetch1() _get1() _posibble_get1_bis() some code _fetch2() _get2() _possible_get2_bis() that is : you ask for a reply only when you need it. > B) although a bunch of prefetch() calls can be queued up, the > corresponding fetch() calls must occur in the same order. > e.g. one must do: > /* queue up some requests */ > prop1_prefetch(); > prop2_prefetch(); > > /* some time later */ > prop1_fetch(); > prop1_get(); > prop2_fetch(); > prop2_get(); yes. It is important as the X server assure you that the replies are sent in the same order than the requests. You might want different order, but you will maybe have some problems. I can't do much more as it's in X Window spec :) > Since the whole point of this api is to make things asynchronous, the > prefetches are likely to be in different parts of the code than the > fetches. This would in the least have to be very clearly documented... Actually, it's not well documented because I wanted to write some doc once raster would have answered to my mail. Unfortunately, I'll have no computer for some days, maybe weeks and I can't work on the code until i get a new one. I can still read my mail. Vincent ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
