tls.c

dgd/mud/kernel/lib/api/tls.c · 846 B

From the archive dgd-1.2p4.tar.gz

Download the archive   « Back to the archive contents

# include <kernel/kernel.h>

private object driver;		/* driver object has direct access to TLS */

/*
 * NAME:	create()
 * DESCRIPTION:	initialize API
 */
static void create()
{
    driver = find_object(DRIVER);
}

/*
 * NAME:	get_tlvar()
 * DESCRIPTION:	get value of TLS variable
 */
static mixed get_tlvar(int index)
{
    if (index < 0) {
	error("Array index out of range");
    }
    return driver->get_tlvar(index);
}

/*
 * NAME:	set_tlvar()
 * DESCRIPTION:	set value of TLS variable
 */
static void set_tlvar(int index, mixed value)
{
    if (index < 0) {
	error("Array index out of range");
    }
    driver->set_tlvar(index, value);
}

/*
 * NAME:	set_tls_size()
 * DESCRIPTION:	set size of TLS storage
 */
static void set_tls_size(int size)
{
    if (size < 0) {
	error("TLS size must be >= 0");
    }
    driver->set_tls_size(size);
}

Site Stats

Snippets: 1791
Codebases: 571