[DGD]LPC- and Kernel-library questions

Ludger Merkens balduin at uni-paderborn.de
Wed May 17 16:09:38 CEST 2000


On Wed, 17 May 2000 birgit.schulte at philips.com wrote:

 
Hiyas,
 
> two things which riddle my brain and I failed to figure out so far:
> 
> In the driver of the kernel-lib there is this function:
> 
> private mixed call(mixed what, string func)
> {
>     object obj;
> 
>     obj = what;
>     what = allocate(TLS_SIZE);
>     return call_other(obj, func);
> }
> 
> Comment says, it provides thread local storage. Obviously, this is done by
> what = allocate(TLS_SIZE);
> Now, could anyone explain what exactly happens here? What is it good for to
> allocate some memory assigned to the variable what?
> Or rather more to the point: what does this concept of thread local storage stand for?

TLS means Thread Local Storage, it is a concept to avoid bottlenecks when
multiprocessor-support in dgd will be implemented.

Look at a global variable e.g. the data needed for this_player(),
To avoid mismatches in an multi-processor,multi-threaded environment we
had to use locking mechanisms effectively undoing the effects of our
effords to use multithreading. TLS is a solution in a way that you make
such data availiable to one thread only.

> 
> Next one is probably just my lack of knowledge:
> The kfun catch is documented as to take two statements (a,b) and to 
> evaluate them.
> In the auto object of the kernel lib in function compile_object there is a part:
> catch { some statements} : { some more statements }
> 
Indeed, there is no documentation on this syntax. At least I didn't find
any. I guess it means something like

try { some statements }
onfailure { some more statements}

> Is this a C-construct which I failed to find, or is it LPC-specific?
> 
really don't know.


Ludger



List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list