Attempt to speed up AutoUpdate for high concurrency.
Attempt to speed up AutoUpdate for high concurrency.

The goal is to get rid of any situations where multiple threads will be
spawned due to concurrent calls to the action. To do this, we take
advantage of unsafePerformIO. This allows us to keep a single
atomicModifyIORef call, which will always either:

1. Get the current value from the AutoUpdated constructor.
2. Spawn a new thread and calculate a new value in a separate thunk, and
   *immediately* return a new AutoUpdated constructor so that future
   calls will immediately get the same generated value. However, since the
   value is in fact an IO action in a thunk, future threads will all block
   for that single value to be calculated. Since unsafePerformIO does
   automatically applies non-duplication, we know the action will only be
   run once.
3. Decide that it's not yet time to do automatic updating, and return a
   ManualUpdates with a Manual action.

coypoop/wai,frontrowed/wai,awpr/wai,mfine/wai,coypoop/wai,dylex/wai,rgrinberg/wai,iquiw/wai,dylex/wai,jberryman/wai,AndrewRademacher/wai,utdemir/wai,erikd/wai,urbanslug/wai,mfine/wai,awpr/wai,ygale/wai,soenkehahn/wai,rgrinberg/wai,creichert/wai,yesodweb/wai,jberryman/wai,creichert/wai,frontrowed/wai,coypoop/wai,utdemir/wai,kazu-yamamoto/wai,sordina/wai,coypoop/wai,frontrowed/wai,jberryman/wai,urbanslug/wai,tolysz/wai,AndrewRademacher/wai,rgrinberg/wai,tolysz/wai,erikd/wai,yesodweb/wai,utdemir/wai,sordina/wai,sordina/wai,awpr/wai,ygale/wai,tolysz/wai,erikd/wai,utdemir/wai,rgrinberg/wai,tolysz/wai,soenkehahn/wai,awpr/wai,soenkehahn/wai,dylex/wai,AndrewRademacher/wai,urbanslug/wai,urbanslug/wai,soenkehahn/wai,sordina/wai,iquiw/wai,dylex/wai,ygale/wai,frontrowed/wai,ygale/wai,AndrewRademacher/wai,rgrinberg/wai,jberryman/wai,kazu-yamamoto/wai,mfine/wai,erikd/wai,iquiw/wai,mfine/wai,iquiw/wai