From duncan at bayne.id.au Sat Jan 1 00:21:06 2022 From: duncan at bayne.id.au (Duncan Bayne) Date: Sat, 01 Jan 2022 11:21:06 +1100 Subject: Shadowing special variables in threaded handlers In-Reply-To: References: <8735massuv.fsf@bayne.id.au> <12B7FABC-64E2-4521-9969-19513B304D80@gmail.com> <87zgohqszs.fsf@bayne.id.au> <4DE6BEF8-BD7C-4990-9861-29891BF1D673@gmail.com> Message-ID: <87wnjkqpal.fsf@bayne.id.au> Stelian Ionescu writes: > The whole point of special variables is to make it oblivious whether > one is using the global binding or a thread-local binding, so code > shouldn't be aware of that in general. Attached is the patch I went with courtesy you and Chun Tian - it works very nicely, thank you both :) In summary, the approach I took was: 1. Use a helper to create a handler closure that closes over the shadowed variables, thereby making the correct values available on all threads. 2. Add the root path to the request class, conceptually treating requests as relative to a particular root, and handily avoiding the same threading + shadowed variable issue with *germinal-root*. Now I can set a temporary context in my tests with a let form, and the world is a happier place :) Happy New Year :) -- Duncan Bayne +61 420 817 082 | https://duncan.bayne.id.au/ I usually check my mail every 24 - 48 hours. If there's something urgent going on, please send me an SMS or call me. -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-Honor-shadowed-config-variables.patch Type: text/x-diff Size: 6619 bytes Desc: not available URL: