Skip to content

Commit

Permalink
Update header file guard.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jackarain committed Nov 3, 2023
1 parent 58e4bb5 commit d6a3b8d
Show file tree
Hide file tree
Showing 5 changed files with 487 additions and 246 deletions.
4 changes: 3 additions & 1 deletion httpd/include/httpd/misc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
//
//

#pragma once
#ifndef INCLUDE__2023_11_03__MISC_HPP
#define INCLUDE__2023_11_03__MISC_HPP

#include <algorithm>
#include <iterator>
Expand Down Expand Up @@ -209,3 +210,4 @@ inline int platform_init()
return 0;
}

#endif // INCLUDE__2023_11_03__MISC_HPP
5 changes: 4 additions & 1 deletion httpd/include/httpd/publish_subscribe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
//
//

#pragma once
#ifndef INCLUDE__2023_11_03__PUBLISH_SUBSCRIBE_HPP
#define INCLUDE__2023_11_03__PUBLISH_SUBSCRIBE_HPP

#include <vector>
#include <functional>
Expand Down Expand Up @@ -59,3 +60,5 @@ class publish_subscribe
private:
subscribe_list_type subscribes_;
};

#endif // INCLUDE__2023_11_03__PUBLISH_SUBSCRIBE_HPP
16 changes: 15 additions & 1 deletion httpd/include/httpd/scoped_exit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
// Email: jack.wgm at gmail dot com
//

#pragma once
#ifndef INCLUDE__2023_10_18__SCOPED_EXIT_HPP
#define INCLUDE__2023_10_18__SCOPED_EXIT_HPP


#include <type_traits>

Expand Down Expand Up @@ -47,6 +49,16 @@ class scoped_exit
f_();
}

inline void operator()()
{
if (stop_token_)
return;

stop_token_ = true;

f_();
}

inline void cancel()
{
stop_token_ = true;
Expand All @@ -56,3 +68,5 @@ class scoped_exit
T f_;
bool stop_token_{ false };
};

#endif // INCLUDE__2023_10_18__SCOPED_EXIT_HPP
Loading

0 comments on commit d6a3b8d

Please sign in to comment.