2.3.0 • Published 8 months ago

@smake/queue v2.3.0

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

C++ Queue Library

namespace ex {
class safe_queue; // 线程安全队列
} // namespace ex
#include <chrono>
#include <ex/safe_queue.h>
#include <iostream>
#include <string>
#include <thread>

using namespace std::chrono_literals;

ex::safe_queue<std::string> q;

int main() {
  std::thread t1([]() {
    while (true) {
      std::this_thread::sleep_for(1s);
      q.enqueue("I will kill you!");
    }
  });

  std::thread t2([]() {
    while (true) {
      auto msg = q.dequeue();
      std::cout << msg << std::endl;
    }
  });

  t1.join();
  t2.join();
  return 0;
}
2.3.0

8 months ago

2.2.0

8 months ago

2.1.0

1 year ago

1.0.1

3 years ago

2.0.0

2 years ago

1.0.0

3 years ago