Bug 42254

Summary: ThreadSpecific (QThreadStorage) should not be deleted
Product: WebKit Reporter: Zoltan Herczeg <zherczeg>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: barraclough, ggaren, oliver, paroga
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
patch oliver: review-

Zoltan Herczeg
Reported 2010-07-14 06:04:32 PDT
Not sure this is the best thing, but something should be done with the annoying "QThreadStorage: Thread %p exited after QThreadStorage %d destroyed" messages. QThreadStorageData::finish in http://qt.gitorious.org/qt/qt/blobs/4.7/src/corelib/thread/qthreadstorage.cpp
Attachments
patch (3.33 KB, patch)
2010-07-14 06:12 PDT, Zoltan Herczeg
oliver: review-
Zoltan Herczeg
Comment 1 2010-07-14 06:12:13 PDT
Zoltan Herczeg
Comment 2 2010-07-16 00:08:44 PDT
Any thoughts? As I mentioned I am not sure this is the best soultion, but I would like to get rid of that annoying warning.
Gavin Barraclough
Comment 3 2010-07-16 11:19:59 PDT
Looks right, but I'd like oliver to review.
Oliver Hunt
Comment 4 2010-07-23 00:32:14 PDT
Comment on attachment 61512 [details] patch There is no requirement that the first client of JSC be a browser, nor that alternate threads be workers. JSC has multiple mac clients that use jsc off the main thread, and CFNetwork uses JSC for PAC files, so "// This function surely called from the main thread first," Is incorrect. If you really felt that this should be persistent you would either have to add a lock on stackGuards or push it into initializeThreading (or whatever that function is called). That said I don't understand why Qt has a requirement that thread specific data not ever be removed -- this code seems to work with pthreads, and with windows' thread specific storage so i'm not sure why qt doesn't.
Zoltan Herczeg
Comment 5 2010-07-23 01:05:36 PDT
I would prefer a write brarrier, but WTF does not support it :( (and AtomicIncrease is not supported by all platforms) A global lock would probably need a global constructor, and that is not preferred as well. Qt is rather stupid in this case. The ThreadStorageData object has a destructor, which is called when the threads free their thread specific objects: ThreadStorageData<T>::destroy(T*) { ... } The destroy functions are registered in a list, and Qt require that the object exists, when the thread quit. This is somewhat stupid, since destroy could be a static function, which could free T without a 'this' argument. Perhaps they had problems with dynamically unloadable libraries, and decided that ThreadStorageData should never be destroyed. No idea. Ok, I will find a different solution.
Patrick R. Gansterer
Comment 6 2012-07-26 05:57:54 PDT
Since https://trac.webkit.org/changeset/101477 QThreadStorage isn't used any more.
Note You need to log in before you can comment on or make changes to this bug.