summaryrefslogtreecommitdiff
path: root/src/stdio/putc.h
AgeCommit message (Collapse)AuthorLines
2018-10-18further optimize getc/putc when locking is neededRich Felker-5/+5
check whether the lock is free before loading the calling thread's tid. if so, just use a dummy tid value that cannot compare equal to any actual thread id (because it's one bit wider). this also avoids the need to save the tid and pass it to locking_getc or locking_putc, reducing register pressure. this change might slightly hurt the case where the caller already holds the lock, but it does not affect the single-threaded case, and may significantly improve the multi-threaded case, especially on archs where loading the thread pointer is disproportionately expensive like early mips and arm ISA levels. but even on i386 it helps, at least on some machines; I measured roughly a 10-15% improvement.
2018-10-18fix build regression due to missing file for putc changesRich Felker-0/+22
commit d664061adb4d7f6647ab2059bc351daa394bf5da inadvertently omitted the new file putc.h.