TGTGInsighttelegram intelligenceLIVE / telegram public index
← QC 的小树林
QC 的小树林 avatar

TGINSIGHT POST

Post #1036

@QC_Grove

QC 的小树林

Views356帖子阅读量
发布3月16日2026/03/16 06:41
Post content

帖子内容

学会了 spinlock 的正确写法,加一个 while (*xp == 1) 的内部 spin 原地提速 30%👍 --- a/bad.c +++ b/good.c @@ -34,8 +34,10 @@ static inline int read_once(const xchglock_t *p) static inline void xchg_lock(xchglock_t *xp) { - while (xchg(xp, 1) == 1) - ; + while…