mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-07 11:48:30 +00:00
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:
parent
25041b8026
commit
d5312b60f7
60 changed files with 890 additions and 629 deletions
24
third_party/gdtoa/dmisc.c
vendored
24
third_party/gdtoa/dmisc.c
vendored
|
@ -35,31 +35,31 @@
|
|||
void
|
||||
freedtoa(char *s)
|
||||
{
|
||||
ThInfo *TI = 0;
|
||||
Bigint *b = (Bigint *)((int *)s - 1);
|
||||
b->maxwds = 1 << (b->k = *(int*)b);
|
||||
__gdtoa_Bfree(b);
|
||||
b->maxwds = 1 << (b->k = *(int *)b);
|
||||
__gdtoa_Bfree(b, &TI);
|
||||
}
|
||||
|
||||
char *
|
||||
__gdtoa_rv_alloc(int i)
|
||||
__gdtoa_rv_alloc(int i, ThInfo **PTI)
|
||||
{
|
||||
int j, k, *r;
|
||||
j = sizeof(ULong);
|
||||
for(k = 0;
|
||||
(int)(sizeof(Bigint) - sizeof(ULong) - sizeof(int)) + j <= i;
|
||||
j <<= 1)
|
||||
k++;
|
||||
r = (int*)__gdtoa_Balloc(k);
|
||||
for (k = 0; (int)(sizeof(Bigint) - sizeof(ULong) - sizeof(int)) + j <= i;
|
||||
j <<= 1)
|
||||
k++;
|
||||
r = (int *)__gdtoa_Balloc(k, PTI);
|
||||
*r = k;
|
||||
return (char *)(r+1);
|
||||
return (char *)(r + 1);
|
||||
}
|
||||
|
||||
char *
|
||||
__gdtoa_nrv_alloc(char *s, char **rve, int n)
|
||||
__gdtoa_nrv_alloc(char *s, char **rve, int n, ThInfo **PTI)
|
||||
{
|
||||
char *rv, *t;
|
||||
t = rv = __gdtoa_rv_alloc(n);
|
||||
while((*t = *s++) !=0)
|
||||
t = rv = __gdtoa_rv_alloc(n, PTI);
|
||||
while ((*t = *s++) != 0)
|
||||
t++;
|
||||
if (rve)
|
||||
*rve = t;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue