예제 #1
0
int
rumpuser_thread_create(void *(*f)(void *), void *arg, const char *thrname,
	int joinable, int pri, int cpuidx, void **tptr)
{
	struct bmk_thread *thr;

	thr = bmk_sched_create(thrname, NULL, joinable,
	    (void (*)(void *))f, arg, NULL, 0);
	if (!thr)
		return BMK_EINVAL;

	*tptr = thr;
	return 0;
}
예제 #2
0
	struct schedulable *scd = (struct schedulable *)curtcb;

	*data = (struct lwpctl *)&scd->scd_lwpctl;
	return 0;
}

int
pthread__makelwp(void (*start)(void *), void *arg, void *private,
	void *stack_base, size_t stack_size, unsigned long flag, lwpid_t *lid)
{
	struct schedulable *scd = private;
	static int nextlid = 2;
	*lid = nextlid++;

	scd->scd_lwpid = *lid;
	scd->scd_thread = bmk_sched_create("lwp", scd, 0, start, arg,
	    stack_base, stack_size);
	if (scd->scd_thread == NULL)
		return EBUSY; /* ??? */
	TAILQ_INSERT_TAIL(&scheds, scd, entries);

	return 0;
}

static struct schedulable *
lwpid2scd(lwpid_t lid)
{
	struct schedulable *scd;

	TAILQ_FOREACH(scd, &scheds, entries) {
		if (scd->scd_lwpid == lid)
			return scd;