Re: [EGIT PATCH 02/11] Use Set instead of array to keep track of change listeners

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Shawn O. Pearce
Date: Thursday, February 5, 2009 - 8:48 am

Tor Arne Vestbø <torarnv@gmail.com> wrote:

See anything wrong here, like that the Set can be modified while
GitProjectData's class lock is held, but its being read here without
any locking?

The array trick worked before because we always made a copy anytime
the array was modified.  So we could safely return the array to the
caller and let the caller iterate it unlocked; we just had to read
the current array using a synchronized method to ensure we had a
stable read.

You'll need to copy the Set somehow while inside of a synchronized
method, then return the copy to the fireRepositoryChanged() method
so it can iterate the copy to fire the events.

-- 
Shawn.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[EGIT PATCH 00/11] Support customizable label decorations, Tor Arne Vestbø, (Wed Feb 4, 6:00 pm)
[EGIT PATCH 03/11] Add a specialized team exception for Git, Tor Arne Vestbø, (Wed Feb 4, 6:00 pm)
Re: [EGIT PATCH 02/11] Use Set instead of array to keep tr ..., Shawn O. Pearce, (Thu Feb 5, 8:48 am)
Re: [EGIT PATCH 00/11] Support customizable label decorations, Tor Arne Vestbø, (Thu Feb 5, 11:37 am)