Some code still uses pthread directly. Now that we have this fancy threading abstraction API, we should use it everywhere.
Created attachment 17203 [details] Reimplements IconDatabase and SQLiteDatabase in terms of threading API
Comment on attachment 17203 [details] Reimplements IconDatabase and SQLiteDatabase in terms of threading API I wanted to get to this ever since we first landed the abstraction - thanks for taking it on! I have a few nitpicks: > createThread( IconDatabase::iconDatabaseSyncThreadStart, this ); No space inside the parens. Occurs in a few places. > if(!m_syncThread) Space after the if. > -#if PLATFORM(DARWIN) > - ASSERT(pthread_main_np()); > -#endif This block of code is valuable, and I would like to see it eventually expanded to include all platforms. The Threading abstraction doesn't yet support a "getMainThreadID()" so there's not (yet) a drop in replacement, so I'm a little torn on what to do with it now... Since adding such an interface would be an exercise in adding platform specific code whereas this patch is an exercise in removing it! I think leaving this block for now (along with the pthread.h include for DARWIN only) and filing a bug with a FIXME would be sufficient. > -#ifndef NDEBUG > - memset(&m_openingThread, 0, sizeof(pthread_t)); > -#endif It might not be critically necessary since it's debug-only code, but I'd like to see the thread identifier zero'ed out in the initialization list in place of this code.
Created attachment 17206 [details] Reimplements IconDatabase and SQLiteDatabase in terms of threading API Updated threading stuff... basically puts back the assert and sets m_openingThread to 0
Comment on attachment 17206 [details] Reimplements IconDatabase and SQLiteDatabase in terms of threading API There's still the style-only tweaks I mentioned (re: parenthesis) > #ifndef NDEBUG >- memset(&m_openingThread, 0, sizeof(pthread_t)); >+ m_openingThread = 0; > #endif Since it's just an integral type now and we set m_openingThread(0) in the initializer list, maybe we should just remove the #ifndef NDEBUG/#endif here.
Created attachment 17207 [details] Reimplements IconDatabase and SQLiteDatabase in terms of threading API Hopefully final review :)
Comment on attachment 17207 [details] Reimplements IconDatabase and SQLiteDatabase in terms of threading API Yay! There *is* still one style issue left - if(!m_syncThread) should be if (!m_syncThread) Otherwise looks great
Landed in r27717 with coding style tweaks.