Re: [RFC] Thread safety in some low-level functions
- From
Matheus Tavares Bernardino <matheus.bernardino@usp.br>
- Date
- Jun 24, 2020, 22:52 UTC
- Message-ID
- <CAHd-oW5jCWeWDcMhLU2Zf96uTtxLehVsM+StDC8LZga282cDjw@mail.gmail.com>
- In-Reply-To
- <CAHd-oW5zh=BG29O0Z-M7R26Lgd=RHECMV2+qByF+vU6PmrEn_Q@mail.gmail.com>
On Wed, Jun 24, 2020 at 7:29 PM Matheus Tavares Bernardino <matheus.bernardino@usp.br> wrote:
Show 7 quoted lines
> > - Regarding, oid_to_hex(), a patch from 2010 [1] proposed a solution > using thread-local storage and pthread_once(). But as Hannes pointed > out in this other thread [2] , implementing a Windows equivalence for > pthread_once() could be tricky and voluminous. Since this thread dates > from 7 years ago, I was wondering if we would be able to implement it > nowadays with InitOnceExecuteOnce() [3].
I forgot to link it before, but here is a commit in libav.git which emulates pthread_once(): https://git.libav.org/?p=libav.git;a=commitdiff;h=b22693b06d1e5d73454a65c203b4d31c1ca5b69a
The patch is not so big, and if we consider only Vista+, it seems very straightforward. I'm not very familiar with Windows, though, and I'm not sure if this solution would work for us.