Arc Forumnew | comments | leaders | submitlogin
2 points by akkartik 5298 days ago | link | parent

The wart webserver should now spawn threads instead of forking processes if win32 supports them.

  wart> (http-serve)
  nil ; works!
  wart> (defurl "/foo"(req) (prn "hi"))
Now try pointing your browser at http://127.0.0.1:8080/foo

But tests that use fork still won't run.

https://github.com/akkartik/wart/commit/fc421629d5072fbb1b88...



2 points by joebo 5298 days ago | link

Hi akkartik - Thank you! Your code helped me greatly. there's an issue though with it. The spawn actually needs to happen after the socket is connected. see this for an example:

https://gist.github.com/824730

I tried this on win32 and it works fine. You can see the effect of the thread if you put a (sleep 5) before the dispatch. Multiple requests can connect and then each completes 5 seconds later.

Note: To get threads working on win32, I used this build of SBCL http://www.siftsoft.com/inprogress/sbcl-1.0.44.211.msi from this thread: http://dmitry-vk.livejournal.com/35946.html

Note: I know there's some rookie stuff in the arc/sbcl code of mine. I could replace the lets with withs but am still learning.

-----

1 point by akkartik 5297 days ago | link

So the default windows build doesn't have fork or threads?

Yeah I added the per-request spawn a couple of hours after the initial naive version. Have you pulled recently?

https://github.com/akkartik/wart/commit/77c353a1a86c99761dd1... [1]

The spawn doesn't happen quite where it does in your version, so I think the master ends up doing a little more work per request. Let me know if that has implications; I think you know more about this.

[1] Buggy version, but next commit was good. Just do a git pull.

-----