private int Open(ServiceCtx context, string path)
        {
            if (context.Process == _owner)
            {
                if (_deviceFileRegistry.TryGetValue(path, out Type deviceFileClass))
                {
                    ConstructorInfo constructor = deviceFileClass.GetConstructor(new Type[] { typeof(ServiceCtx) });

                    NvDeviceFile deviceFile = (NvDeviceFile)constructor.Invoke(new object[] { context });

                    return(_deviceFileIdRegistry.Add(deviceFile));
                }
                else
                {
                    Logger.PrintWarning(LogClass.ServiceNv, $"Cannot find file device \"{path}\"!");
                }
            }

            return(-1);
        }
Exemple #2
0
        public static void InitializeNvMap(ServiceCtx Context)
        {
            IdDictionary Dict = Maps.GetOrAdd(Context.Process, (Key) => new IdDictionary());

            Dict.Add(0, new NvMapHandle());
        }
Exemple #3
0
        public static void InitializeNvMap(ServiceCtx context)
        {
            IdDictionary dict = _maps.GetOrAdd(context.Process, (key) => new IdDictionary());

            dict.Add(0, new NvMapHandle());
        }
Exemple #4
0
 public void Add(T obj)
 {
     objects.Add(obj);
     objectsById.Add(obj);
 }
Exemple #5
0
        public NvMapDeviceFile(ServiceCtx context) : base(context)
        {
            IdDictionary dict = _maps.GetOrAdd(Owner, (key) => new IdDictionary());

            dict.Add(0, new NvMapHandle());
        }
Exemple #6
0
        public NvMapDeviceFile(ServiceCtx context, IVirtualMemoryManager memory, long owner) : base(context, owner)
        {
            IdDictionary dict = _maps.GetOrAdd(Owner, (key) => new IdDictionary());

            dict.Add(0, new NvMapHandle());
        }
 public int OpenHandle(object Obj)
 {
     return(Handles.Add(Obj));
 }
        private int CreateHandleFromMap(NvMapHandle map)
        {
            IdDictionary dict = _maps.GetOrAdd(Owner, (key) => new IdDictionary());

            return(dict.Add(map));
        }