-
Notifications
You must be signed in to change notification settings - Fork 446
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
117 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,44 +1,47 @@ | ||
#pragma once | ||
|
||
#include <chrono> | ||
#include <system_error> | ||
#include <functional> | ||
#include <system_error> | ||
|
||
#include "opentelemetry/version.h" | ||
|
||
OPENTELEMETRY_BEGIN_NAMESPACE | ||
namespace sdk { | ||
namespace event { | ||
namespace sdk | ||
{ | ||
namespace event | ||
{ | ||
using TimerCallback = std::function<void()>; | ||
|
||
/** | ||
* Manages a timer event. | ||
* | ||
* Note: Must be freed before the dipatcher is destructed | ||
*/ | ||
class Timer { | ||
public: | ||
virtual ~Timer() = default; | ||
class Timer | ||
{ | ||
public: | ||
virtual ~Timer() = default; | ||
|
||
/** | ||
* Enable a pending timeout. If a timeout is already pending, it will be reset to the new | ||
* timeout. | ||
*/ | ||
virtual void EnableTimer(std::chrono::microseconds timeout) noexcept = 0; | ||
/** | ||
* Enable a pending timeout. If a timeout is already pending, it will be reset to the new | ||
* timeout. | ||
*/ | ||
virtual void EnableTimer(std::chrono::microseconds timeout) noexcept = 0; | ||
|
||
template <class Rep, class Period> | ||
void EnableTimer(std::chrono::duration<Rep, Period> timeout) noexcept | ||
{ | ||
this->EnableTimer(std::chrono::duration_cast<std::chrono::microseconds>(timeout)); | ||
} | ||
template <class Rep, class Period> | ||
void EnableTimer(std::chrono::duration<Rep, Period> timeout) noexcept | ||
{ | ||
this->EnableTimer(std::chrono::duration_cast<std::chrono::microseconds>(timeout)); | ||
} | ||
|
||
/** | ||
* Disable a pending timeout. | ||
* | ||
* If no timeout is active, it does nothing. | ||
*/ | ||
virtual void DisableTimer() noexcept = 0; | ||
/** | ||
* Disable a pending timeout. | ||
* | ||
* If no timeout is active, it does nothing. | ||
*/ | ||
virtual void DisableTimer() noexcept = 0; | ||
}; | ||
} // namespace event | ||
} // namespace sdk | ||
} // namespace event | ||
} // namespace sdk | ||
OPENTELEMETRY_END_NAMESPACE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
add_library(opentelemetry_event_libevent | ||
dispatcher.cc | ||
event.cc | ||
event_base.cc | ||
file_event.cc | ||
timer.cc) | ||
add_library(opentelemetry_event_libevent dispatcher.cc event.cc event_base.cc | ||
file_event.cc timer.cc) | ||
target_link_libraries(opentelemetry_event_libevent ${LIBEVENT_LIBRARIES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.