Browse Source

Add App Engine support

App Engine disallows package unsafe. As a workaround for the (unsafe)
RCU atomic pointer shenanigans we pull in order to avoid taking a lock
in the hot routing path, let's just grab the lock. Honestly, I doubt
anyone will notice anyways, especially considering the fact that App
Engine is single-threaded anyways.

Fixes #52.
Carl Jackson 12 years ago
parent
commit
17b9035bcd
2 changed files with 16 additions and 0 deletions
  1. +2
    -0
      web/atomic.go
  2. +14
    -0
      web/atomic_appengine.go

+ 2
- 0
web/atomic.go View File

@ -1,3 +1,5 @@
// +build !appengine
package web package web
import ( import (


+ 14
- 0
web/atomic_appengine.go View File

@ -0,0 +1,14 @@
// +build appengine
package web
func (rt *router) getMachine() *routeMachine {
rt.lock.Lock()
defer rt.lock.Unlock()
return rt.machine
}
// We always hold the lock when calling setMachine.
func (rt *router) setMachine(m *routeMachine) {
rt.machine = m
}

Loading…
Cancel
Save