Make improvements to locking

This change makes pthread_mutex_lock() as fast as _spinlock() by
default. Thread instability issues on NetBSD have been resolved.
Improvements made to gdtoa thread code. Crash reporting will now
synchronize between threads in a slightly better way.
This commit is contained in:
Justine Tunney 2022-06-19 01:13:03 -07:00
parent 25041b8026
commit d5312b60f7
60 changed files with 890 additions and 629 deletions

View file

@ -33,27 +33,27 @@
/* clang-format off */
Bigint *
__gdtoa_s2b(const char *s, int nd0, int nd, ULong y9, int dplen)
__gdtoa_s2b(const char *s, int nd0, int nd, ULong y9, int dplen, ThInfo **PTI)
{
Bigint *b;
int i, k;
Long x, y;
x = (nd + 8) / 9;
for(k = 0, y = 1; x > y; y <<= 1, k++) ;
b = __gdtoa_Balloc(k);
b = __gdtoa_Balloc(k, PTI);
b->x[0] = y9;
b->wds = 1;
i = 9;
if (9 < nd0) {
s += 9;
do b = __gdtoa_multadd(b, 10, *s++ - '0');
do b = __gdtoa_multadd(b, 10, *s++ - '0', PTI);
while(++i < nd0);
s += dplen;
}
else
s += dplen + 9;
for(; i < nd; i++)
b = __gdtoa_multadd(b, 10, *s++ - '0');
b = __gdtoa_multadd(b, 10, *s++ - '0', PTI);
return b;
}