Ejemplo n.º 1
0
void LmuxAcquire(lmutex_t *mux)
{
    unsigned my_id;
    volatile lmutex_t *vmux = (volatile lmutex_t*) mux;

    my_id = ThrGetThreadInfo()->id;

    if (vmux->owner == my_id)
    {
	_wdprintf(L"LmuxAcquire(%p/%u): recursive acquisition by %u\n",
	    vmux, vmux->mutex, my_id);
	__asm__("int3");
    }

    if (SysIncrement(&vmux->locks) > 0)
    {
	if (!SemDown(vmux->mutex))
	    __asm__("int3");

	if (vmux->owner != 0)
	{
	    _wdprintf(L"LmuxAcquire(%p/%u): still locked by %u, %u contend\n",
		vmux, vmux->mutex, vmux->owner, my_id);
	    __asm__("int3");
	}

	vmux->eip = *(&mux - 1);
	vmux->locks--;
	vmux->owner = my_id;
    }
    else
    {
	vmux->eip = *(&mux - 1);
	vmux->owner = my_id;
    }
}
Ejemplo n.º 2
0
gmgr_surface_t *GmgrCopySurface(gmgr_surface_t *surf)
{
	SysIncrement(&surf->refs);
	return surf;
}