System.Data.SQLite
Check-in [d13b6a5885]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Expand scope for the GC.KeepAlive call in the SQLiteConnectionPool.Add method.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: d13b6a58859d0d15921ce2d75518c2742d54c260
User & Date: mistachkin 2012-05-03 16:44:39
Context
2012-05-03
17:15
Obtain a lock on the connection handle prior to finalizing a statement and/or finishing a backup object. check-in: fbf498a216 user: mistachkin tags: trunk
16:44
Expand scope for the GC.KeepAlive call in the SQLiteConnectionPool.Add method. check-in: d13b6a5885 user: mistachkin tags: trunk
15:58
Fix yet another set of GC race conditions. check-in: 8c76674915 user: mistachkin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to System.Data.SQLite/SQLiteConnectionPool.cs.

250
251
252
253
254
255
256
257
258
259
260
261
262

263
264
265
266
267
268
269
          ResizePool(queue, true);

          Queue<WeakReference> poolQueue = queue.Queue;
          if (poolQueue == null) return;

          poolQueue.Enqueue(new WeakReference(hdl, false));
          Interlocked.Increment(ref _poolClosed);
          GC.KeepAlive(hdl);
        }
        else
        {
          hdl.Close();
        }

      }
    }

    /// <summary>
    /// We don't have to thread-lock anything in this function, because it's only called by other functions above
    /// which already have a thread-safe lock.
    /// </summary>







<





>







250
251
252
253
254
255
256

257
258
259
260
261
262
263
264
265
266
267
268
269
          ResizePool(queue, true);

          Queue<WeakReference> poolQueue = queue.Queue;
          if (poolQueue == null) return;

          poolQueue.Enqueue(new WeakReference(hdl, false));
          Interlocked.Increment(ref _poolClosed);

        }
        else
        {
          hdl.Close();
        }
        GC.KeepAlive(hdl);
      }
    }

    /// <summary>
    /// We don't have to thread-lock anything in this function, because it's only called by other functions above
    /// which already have a thread-safe lock.
    /// </summary>