a3587556
V2EX  ›  编程

请问 C 语言中 LRU Cache 线程安全有什么不加锁的方案吗?

  •  
  •   a3587556 · Jun 15, 2024 · 1557 views
    This topic created in 703 days ago, the information mentioned may be changed or developed.

    我用 LRU Cache 来缓存结果,每一个 bucket 队列中存的是 key-value 键值对,可以对这个队列进行增删查改,现在想用不加锁的方式对其进行线程安全改造,目前已经尝试过原子变量和引用计数,但都能发现还是有线程不安全的场景,请问各位还有什么其他方案吗?

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4205 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 48ms · UTC 10:09 · PVG 18:09 · LAX 03:09 · JFK 06:09
    ♥ Do have faith in what you're doing.