* gtk/TreeNode.cs: Add Interlocked.Increment rather than ++. This
makes it safe to create tree nodes in a worker thread as long as you reparent them into the tree with another thread. Thanks to mk for allowing a bit of threadedness in :-). svn path=/trunk/gtk-sharp/; revision=48683
This commit is contained in:
parent
3fb0631c4e
commit
c9eaab1cf3
2 changed files with 8 additions and 1 deletions
|
@ -1,5 +1,10 @@
|
|||
2005-08-22 Ben Maurer <bmaurer@novell.com>
|
||||
|
||||
* gtk/TreeNode.cs: Add Interlocked.Increment rather than ++. This
|
||||
makes it safe to create tree nodes in a worker thread as long as
|
||||
you reparent them into the tree with another thread. Thanks to mk
|
||||
for allowing a bit of threadedness in :-).
|
||||
|
||||
* gtk/NodeView.cs: Fix leak here. r=mkestner
|
||||
|
||||
2005-08-22 Mike Kestner <mkestner@novell.com>
|
||||
|
|
|
@ -23,9 +23,11 @@ namespace Gtk {
|
|||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
|
||||
public abstract class TreeNode : ITreeNode {
|
||||
|
||||
// Only use interlocked operations
|
||||
static int next_idx = 0;
|
||||
|
||||
int id;
|
||||
|
@ -34,7 +36,7 @@ namespace Gtk {
|
|||
|
||||
public TreeNode ()
|
||||
{
|
||||
id = next_idx++;
|
||||
id = Interlocked.Increment (ref next_idx);
|
||||
}
|
||||
|
||||
public int ID {
|
||||
|
|
Loading…
Add table
Reference in a new issue