Some fixes for Windows threads in SBCL

I've made several more fixes for the support of Windows threads in SBCL:

  • The code is ported to SBCL 1.40 from 1.36;

  • The code received some cleanup to ease merging;

  • Virtual memory page protection attributes are used to implement “gc safepoints”; This has brought the performance back to on par with SBCL. Earlier the following code took 1.529 seconds but now it takes 0.089 seconds

    (loop repeat (expt 10 8))
    
  • SB-THREAD:INTERRUPT-THREAD is now supported to be able to interrupt threads;

  • Fixes for various errors in thread synchronization. Not everything has been fixed yet since the tests still sometimes fail with hard-to-reproduce crashes.

The source code is now on github, and the binary is at http://sites.google.com/site/dmitryvksite/sbcl-distr/sbcl-1.0.40-threads-1.msi.