public int sceKernelCreateMutex( int name, int attr, int option )
        {
            string sname = _kernel.ReadString( ( uint )name );
            KMutex mutex = new KMutex( _kernel, sname, ( uint )attr );
            _kernel.AddHandle( mutex );

            return ( int )mutex.UID;
        }
        // totally guessed - attr and option may not be right, and there may be no name
        // pretty sure param 0 is a pointer though, it just points to \0
        public int sceKernelCreateMutex(int name, int attr, int option)
        {
            string sname = _kernel.ReadString(( uint )name);
            KMutex mutex = new KMutex(_kernel, sname, ( uint )attr);

            _kernel.AddHandle(mutex);

            return(( int )mutex.UID);
        }
        // manual add
        public int sceKernelCancelMutex(int mid)
        {
            KMutex mutex = _kernel.GetHandle <KMutex>(mid);

            if (mutex == null)
            {
                Log.WriteLine(Verbosity.Normal, Feature.Bios, "sceKernelCancelMutex: could not find mutex with ID {0}", mid);
                return(-1);
            }

            return(0);
        }
        // manual add
        public int sceKernelDeleteMutex(int mid)
        {
            KMutex mutex = _kernel.GetHandle <KMutex>(mid);

            if (mutex == null)
            {
                Log.WriteLine(Verbosity.Normal, Feature.Bios, "sceKernelDeleteMutex: could not find mutex with ID {0}", mid);
                return(-1);
            }

            // Wake waiting threads???
            _kernel.RemoveHandle(mutex.UID);

            return(0);
        }
        // not sure what the params here are
        public int sceKernelLockMutex(int mid, int unknown, int timeout)
        {
            KMutex mutex = _kernel.GetHandle <KMutex>(mid);

            if (mutex == null)
            {
                Log.WriteLine(Verbosity.Normal, Feature.Bios, "sceKernelLockMutex: could not find mutex with ID {0}", mid);
                return(-1);
            }

            uint timeoutUs = 0;

            unsafe
            {
                if (timeout != 0)
                {
                    timeoutUs = *(( uint * )_memorySystem.Translate(( uint )timeout));
                }
            }

            mutex.Lock(timeoutUs);

            return(0);
        }