erlang各种有用的函数包括一些有用nif封装,还有一些性能测试case。
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

44 řádky
1.2 KiB

před 4 roky
  1. enlfq
  2. =====
  3. A simple NIF lock-free Queue using the library: [moodycamel::concurrentqueue](https://github.com/cameron314/concurrentqueue/tree/8f7e861dd9411a0bf77a6b9de83a47b3424fafba)
  4. #### moodycamel::ConcurrentQueue
  5. An industrial-strength lock-free queue for C++.
  6. **Features**:
  7. * Knock-your-socks-off blazing fast performance.
  8. * Single-header implementation. Just drop it in your project.
  9. * Fully thread-safe lock-free queue. Use concurrently from any number of threads.
  10. * C++11 implementation -- elements are moved (instead of copied) where possible.
  11. * Templated, obviating the need to deal exclusively with pointers -- memory is managed for you.
  12. * No artificial limitations on element types or maximum count.
  13. * Memory can be allocated once up-front, or dynamically as needed.
  14. * Fully portable (no assembly; all is done through standard C++11 primitives).
  15. * Supports super-fast bulk operations.
  16. * Includes a low-overhead blocking version (BlockingConcurrentQueue).
  17. * Exception safe.
  18. Build
  19. -----
  20. $ rebar3 compile
  21. Using
  22. -----
  23. ```erlang
  24. {ok, Q} = enlfq:new().
  25. T = {any, term, [], #{}, 1}.
  26. true = enlfq:push(Q,T).
  27. {ok, T} = enlfq:pop(Q).
  28. empty = enlfq:pop(Q).
  29. ```