pagespeed/ngx_pagespeed — pull request #31 by bnoordhuis (2012-11-08 03:14:34+00:00)
Title: ngx_base_fetch: implement locking

Implement the Lock() and Unlock() methods. It uses a spinlock because:

a) ngx_mutex_t is only available when NGX_THREADS is defined (which is never).
b) ngx_shmtx_t is a spinlock in disguise that falls back to a semaphore after a few spins, but:
c) ngx_pagespeed doesn't do hugely expensive things in its critical sections. It seems a shame risk getting rescheduled just because there's a few nanoseconds of contention.

That said, I don't mind rewriting it as ngx_shm code if people feel strongly about it. :-)