Skip to content

Instantly share code, notes, and snippets.

Joshua Marantz jmarantz

Block or report user

Report or block jmarantz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View placed_new.cc
#include <cstdlib>
#include <cstdint>
#include <cstring>
#include <iostream>
#include <memory>
#include <string>
class InlineStorage {
public:
// Custom delete operator to keep C++14 from using the global operator delete(void*, size_t),
@jmarantz
jmarantz / gist:d22b836cee3ca203cc368553eda81ce5
Created May 22, 2018
alternate implementation of CondVar using std::condition_variable_any
View gist:d22b836cee3ca203cc368553eda81ce5
class CondVar {
public:
// Note that it is not necessary to be holding an associated mutex to call signal).
// See the discussion in
// http://en.cppreference.com/w/cpp/thread/condition_variable_any/notify_one
// for more details.
void notifyOne() { condvar_.notify_one(); }
void notifyAll() { condvar_.notify_all(); };
template <class LockGuard>
void wait(LockGuard& guard) EXCLUSIVE_LOCKS_REQUIRED(guard) {
You can’t perform that action at this time.