Beispiel #1
0
        internal static ITrack Get(ISession session, IntPtr handle)
        {
            NativeTrack track;

            lock (_instanceLock)
            {
                if (_instances.TryGetValue(handle, out track))
                {
                    return track;
                }
            }

            track = new NativeTrack(session, handle);
            track.Initialize();

            if (SessionFactory.IsInternalCachingEnabled)
            {
                lock (_instanceLock)
                {
                    _instances.SetValue(handle, track);
                }
            }

            return track;
        }
Beispiel #2
0
        internal static ITrack Get(ISession session, IntPtr handle)
        {
            lock (_instanceLock)
            {
                NativeTrack instance;

                if (!_instances.TryGetValue(handle, out instance))
                {
                    instance = new NativeTrack(session, handle);
                    _instances.Add(handle, instance);
                    instance.Initialize();
                }

                return instance;
            }
        }