[DGD] Melville under the Kernel Lib

Felix A. Croes felix at dworkin.nl
Fri Feb 6 22:22:23 CET 2004


Michael McKiel <crashnbrn71 at yahoo.ca> wrote:

> I feel I have somewhat of a grip (albeit perhaps a vague one in a few places)
> on the process and how to go about it, and what the KLib and Melville are
> each doing. All except for the Thread Local Storage bit.
> I grep for it, and look over the lib/api/tls.c ... and all its functions
> while again actually defined in the driver itself -- are never actually used.
> The only ones that appear to get called all thru the Kernel Lib is
> query_tls_size(), along with allocates. And Melville doesn't even use TLS at
> all. This is also one thing I couldn't find much resource for in the
> archives. I know a description was given here, but I don't quite "get it" :)
> So what I'm wondering is why are there so many tlvar functions that are never
> used...what instances might require them to be ? 

Forget about how they're implemented, then.  This is what you'd use them
for:

    inherit "/kernel/lib/api/tls";

    void create()
    {
	::create();
	set_tls_size(1);	/* one thread local variable, index 0 */
    }

    void set_this_player(object player)
    {
	set_tlsvar(0, player);
    }

    object this_player()	/* return the current player */
    {
	return get_tlsvar(0);
    }

The kernel library itself does not use this interface because it can
access the internals more directly.  It actually uses 3 TLS variables
itself for various purposes.


> And what does the current Melville "lose" from not using TLS at all?

Only DGD/MP preparedness.

Regards,
Dworkin
_________________________________________________________________
List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list