Beispiel #1
0
void
kobj_init(kobj_t obj, kobj_class_t cls)
{
	KOBJ_ASSERT(MA_NOTOWNED);
  retry:
	KOBJ_LOCK();

	/*
	 * Consider compiling the class' method table.
	 */
	if (!cls->ops) {
		/*
		 * kobj_class_compile doesn't want the lock held
		 * because of the call to malloc - we drop the lock
		 * and re-try.
		 */
		KOBJ_UNLOCK();
		kobj_class_compile(cls);
		goto retry;
	}

	kobj_init_common(obj, cls);

	KOBJ_UNLOCK();
}
Beispiel #2
0
void
kobj_init(kobj_t obj, kobj_class_t cls)
{
	/*
	 * Consider compiling the class' method table.
	 */
	if (!cls->ops)
		kobj_class_compile(cls);

	obj->ops = cls->ops;
	cls->refs++;
}
Beispiel #3
0
void
kobj_class_instantiate(kobj_class_t cls)
{
	lwkt_gettoken(&kobj_token);
	crit_enter();

	if (!cls->ops)
		kobj_class_compile(cls);
	cls->refs++;

	crit_exit();
	lwkt_reltoken(&kobj_token);
}