title: Can Thread Local Storage be faked/hacked?
body: <p>I find myself in a bit of a quandry.</p>
  
  <p>I have a large application which has Google's V8 javascript engine.  Some calls are made to the V8 engine on the UI thread.  To be nice to the user like everyone recommends, some long operations are run on a separate thread, without hanging the UI thread.  However, these long running operations also make calls in to the V8 javascript engine.  So multiple threads call in to V8.</p>
  
  <p>Thing is, V8 appears to use thread local storage.  This seems to be making my application randomly explode.  It's definitely in the class of "How was this possibley working up till now?" bugs.</p>
  
  <p>Without significantly re-architecting my application, I propose an ugly, ugly horrible super-hack:  can I make V8 think it's running on a different thread?</p>
  
  <p>In other words, the first time I make a call in to V8, I make a note of the thread.  Then, for <em>all other calls to V8</em>, I somehow spoof the thread so the thread local storage/whatever else thread-dependent works.</p>
  
  <p>Can it be done?  Will it work?  Am I stupid to even consider such a scummy hack?</p>