Re:“POSIX advisory locks are broken by design”
by haimez on Tuesday July 24, 2018 @09:01PM
(#17606203)
Then your thread better only execute one request at a time and carry through every operation involved in that request. Works fine in PHP, not fine in most performant and even most non performant web contexts.
[ Parent
| on HN ]
Re:“POSIX advisory locks are broken by design”
by kazinator on Tuesday July 24, 2018 @09:54PM
(#17606379)
But that's fine. For example, you pull the thread from a pool and bind it to the request. As part of this, the thread pulls the locale object from the request and attaches to it. It services that request, and then returns to the pool. Next time it is pulled from the pool it gets a request in a different locale.
Other disciplines are possible. E.g. some operation involving multiple locales, all in one thread, can just do the uselocale calls as needed.
Re:“POSIX advisory locks are broken by design”
by int_19h on Wednesday July 25, 2018 @03:11AM
(#17607411)
That's not fine, because processing a single request often involves waiting on some I/O, and the thread can service (a part of) another request in the meantime. Which is what modern event loop driven servers do - but this doesn't play well with thread locals, or abstractions implemented on top of them, because now your single physical thread effectively runs multiple cooperatively scheduled logical threads/requests.