diff --git a/websocketpp/concurrency/none.hpp b/websocketpp/concurrency/none.hpp index 9d19d64ce4..873959d8f2 100644 --- a/websocketpp/concurrency/none.hpp +++ b/websocketpp/concurrency/none.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Peter Thorson. All rights reserved. + * Copyright (c) 2014, Peter Thorson. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -29,15 +29,20 @@ #define WEBSOCKETPP_CONCURRENCY_NONE_HPP namespace websocketpp { + +/// Concurrency handling support namespace concurrency { +/// Implementation for no-op locking primitives namespace none_impl { +/// A fake mutex implementation that does nothing class fake_mutex { public: fake_mutex() {} ~fake_mutex() {} }; +/// A fake lock guard implementation that does nothing class fake_lock_guard { public: explicit fake_lock_guard(fake_mutex foo) {} @@ -45,10 +50,27 @@ public: }; } // namespace none_impl -/// Stub Concurrency policy to remove locking in single threaded projects +/// Stub concurrency policy that implements the interface using no-ops. +/** + * This policy documents the concurrency policy interface using no-ops. It can + * be used as a reference or base for building a new concurrency policy. It can + * also be used as is to disable all locking for endpoints used in purely single + * threaded programs. + */ class none { public: + /// The type of a mutex primitive + /** + * std::mutex is an example. + */ typedef none_impl::fake_mutex mutex_type; + + /// The type of a scoped/RAII lock primitive. + /** + * The scoped lock constructor should take a mutex_type as a parameter, + * acquire that lock, and release it in its destructor. std::lock_guard is + * an example. + */ typedef none_impl::fake_lock_guard scoped_lock_type; }; diff --git a/websocketpp/http/constants.hpp b/websocketpp/http/constants.hpp index eac92dbd51..1f71324b97 100644 --- a/websocketpp/http/constants.hpp +++ b/websocketpp/http/constants.hpp @@ -33,6 +33,7 @@ #include namespace websocketpp { +/// HTTP handling support namespace http { /// The type of an HTTP attribute list /** diff --git a/websocketpp/random/none.hpp b/websocketpp/random/none.hpp index 60fe77288e..30854dd233 100644 --- a/websocketpp/random/none.hpp +++ b/websocketpp/random/none.hpp @@ -29,6 +29,7 @@ #define WEBSOCKETPP_RANDOM_NONE_HPP namespace websocketpp { +/// Random number generation policies namespace random { /// Stub RNG policy that always returns 0 namespace none {