On 01/28/10 06:00, "Christiaan Hofman" <cmhof...@gmail.com> wrote:
> I don't remember all that was said about thread safety in relation to bibitems > and type info. I thought that BDSKTypeInfoManager doesn't need to be thread > safe, because it wasn't used on a secondary thread since it wasn't used > anymore for file searching. That seems to be incorrect, as various search > group servers create bibitems on a secondary thread, and that uses the type > manager. So something has to change. Either search groups servers should > always create bibitems on the main thread, or BDSKTypeManager needs to be > thread safe. The latter can be very expensive in regular usage, because the > various typeinfo NSString category methods are called a lot (and especially > those should be made thread safe, because that type info can change). So is it > feasible to create items in search groups on the main thread? I particularly > want to ask Adam, because he wrote the search group servers. Realistically, the only way this could be a problem is if someone edits default field prefs while while actually creating a BibItem and calling the type manager from another thread. That's a very tiny window in practice, but I agree that it's worth trying to fix. I think the easiest (and best-performing) way to do this would be to use a per-thread instance of BDSKTypeManager. I implemented this in my code, but it's only minimally tested. The only slightly tricky part is observing notifications, but that's not too bad. Pushing all of the parsing to the main thread is probably possible, too, but would require code changes and testing in more modules, and be a performance hit. ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-com _______________________________________________ Bibdesk-develop mailing list Bibdesk-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bibdesk-develop