Provides a mechanism for executing a method on a thread pool thread at specified intervals. This class cannot be inherited.
using timer_callback = action<std::any>.
Public Constructors | |
| timer (const timer_callback &callback) | |
| Initializes a new instance of the timer class with an infinite period and an infinite due time, using the newly created timer object as the state object.   | |
| timer (const timer_callback &callback, int32 due_time, int32 period) | |
| Initializes a new instance of the timer class, using a 32-bit signed integer to specify the time interval.   | |
| timer (const timer_callback &callback, int64 due_time, int64 period) | |
| Initializes a new instance of the timer class, using a 64-bit signed integer to specify the time interval.   | |
| timer (const timer_callback &callback, const time_span &due_time, const time_span &period) | |
| Initializes a new instance of the timer class, using a TimaSpan to specify the time interval.   | |
| timer (const timer_callback &callback, uint32 due_time, uint32 period) | |
| Initializes a new instance of the timer class, using a 32-bit unsigned integer to specify the time interval.   | |
| timer (const timer_callback &callback, std::any state, int32 due_time, int32 period) | |
| Initializes a new instance of the timer class, using a 32-bit signed integer to specify the time interval.   | |
| timer (const timer_callback &callback, std::any state, int64 due_time, int64 period) | |
| Initializes a new instance of the timer class, using a 64-bit signed integer to specify the time interval.   | |
| timer (const timer_callback &callback, std::any state, const time_span &due_time, const time_span &period) | |
| Initializes a new instance of the timer class, using a TimaSpan to specify the time interval.   | |
| timer (const timer_callback &callback, std::any state, uint32 due_time, uint32 period) | |
| Initializes a new instance of the timer class, using a 32-bit unsigned integer to specify the time interval.   | |
Public Methods | |
| void | change (int32 due_time, int32 period) | 
| changes the start time and the interval between method invocations for a timer, using 32-bit signed integers to measure time intervals.   | |
| void | change (int64 due_time, int64 period) | 
| changes the start time and the interval between method invocations for a timer, using 64-bit signed integers to measure time intervals.   | |
| void | change (const time_span &due_time, const time_span &period) | 
| changes the start time and the interval between method invocations for a timer, using time_span values to measure time intervals.   | |
| void | change (uint32 due_time, uint32 period) | 
| changes the start time and the interval between method invocations for a timer, using 32-bit unsigned integers to measure time intervals.   | |
| void | close () | 
| Releases all resources used by the current instance of xtd::threading::timer.   | |
Additional Inherited Members | |
  Public Member Functions inherited from xtd::object | |
| object ()=default | |
| Create a new instance of the ultimate base class object.   | |
| virtual bool | equals (const object &obj) const noexcept | 
| Determines whether the specified object is equal to the current object.   | |
| virtual size_t | get_hash_code () const noexcept | 
| Serves as a hash function for a particular type.   | |
| virtual type_object | get_type () const noexcept | 
| Gets the type of the current instance.   | |
| template<typename object_t > | |
| xtd::uptr< object_t > | memberwise_clone () const | 
| Creates a shallow copy of the current object.   | |
| virtual xtd::string | to_string () const noexcept | 
| Returns a xtd::string that represents the current object.   | |
  Static Public Member Functions inherited from xtd::object | |
| template<typename object_a_t , typename object_b_t > | |
| static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept | 
| Determines whether the specified object instances are considered equal.   | |
| template<typename object_a_t , typename object_b_t > | |
| static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept | 
| Determines whether the specified object instances are the same instance.   | |
      
  | 
  explicit | 
Initializes a new instance of the timer class with an infinite period and an infinite due time, using the newly created timer object as the state object.
| callback | the address of a method to be executed | 
| ArgumentNullException | The callback is null. | 
| xtd::threading::timer::timer | ( | const timer_callback & | callback, | 
| int32 | due_time, | ||
| int32 | period | ||
| ) | 
Initializes a new instance of the timer class, using a 32-bit signed integer to specify the time interval.
| callback | the address of a method to be executed | 
| due_time | The amount of time to delay before callback is invoked, in milliseconds. Specify Timeout::Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. | 
| period | The time interval between invocations of callback, in milliseconds. Specify Timeout::Infinite to disable periodic signaling. | 
| ArgumentNullException | The callback is null. | 
| xtd::argument_out_of_range_exception | The due_time or period parameter is negative and is not equal to Timeout::Infinite. | 
| xtd::threading::timer::timer | ( | const timer_callback & | callback, | 
| int64 | due_time, | ||
| int64 | period | ||
| ) | 
Initializes a new instance of the timer class, using a 64-bit signed integer to specify the time interval.
| callback | the address of a method to be executed | 
| due_time | The amount of time to delay before callback is invoked, in milliseconds. Specify Timeout::Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. | 
| period | The time interval between invocations of callback, in milliseconds. Specify Timeout::Infinite to disable periodic signaling. | 
| ArgumentNullException | The callback is null. | 
| xtd::argument_out_of_range_exception | The due_time or period parameter is negative and is not equal to Timeout::Infinite. | 
| xtd::threading::timer::timer | ( | const timer_callback & | callback, | 
| const time_span & | due_time, | ||
| const time_span & | period | ||
| ) | 
Initializes a new instance of the timer class, using a TimaSpan to specify the time interval.
| callback | the address of a method to be executed | 
| due_time | The amount of time to delay before callback is invoked, in milliseconds. Specify Timeout::Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. | 
| period | The time interval between invocations of callback, in milliseconds. Specify Timeout::Infinite to disable periodic signaling. | 
| ArgumentNullException | The callback or due_time or period param is null. | 
| xtd::argument_out_of_range_exception | The due_time or period parameter is negative and is not equal to Timeout::Infinite. | 
| xtd::threading::timer::timer | ( | const timer_callback & | callback, | 
| uint32 | due_time, | ||
| uint32 | period | ||
| ) | 
Initializes a new instance of the timer class, using a 32-bit unsigned integer to specify the time interval.
| callback | the address of a method to be executed | 
| due_time | The amount of time to delay before callback is invoked, in milliseconds. Specify Timeout::Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. | 
| period | The time interval between invocations of callback, in milliseconds. Specify Timeout::Infinite to disable periodic signaling. | 
| ArgumentNullException | The callback is null. | 
| xtd::argument_out_of_range_exception | The due_time or period parameter is negative and is not equal to Timeout::Infinite. | 
| xtd::threading::timer::timer | ( | const timer_callback & | callback, | 
| std::any | state, | ||
| int32 | due_time, | ||
| int32 | period | ||
| ) | 
Initializes a new instance of the timer class, using a 32-bit signed integer to specify the time interval.
| callback | the address of a method to be executed | 
| state | An object containing information to be used by the callback method, or null. | 
| due_time | The amount of time to delay before callback is invoked, in milliseconds. Specify Timeout::Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. | 
| period | The time interval between invocations of callback, in milliseconds. Specify Timeout::Infinite to disable periodic signaling. | 
| ArgumentNullException | The callback is null. | 
| xtd::argument_out_of_range_exception | The due_time or period parameter is negative and is not equal to Timeout::Infinite. | 
| xtd::threading::timer::timer | ( | const timer_callback & | callback, | 
| std::any | state, | ||
| int64 | due_time, | ||
| int64 | period | ||
| ) | 
Initializes a new instance of the timer class, using a 64-bit signed integer to specify the time interval.
| callback | the address of a method to be executed | 
| state | An object containing information to be used by the callback method, or null. | 
| due_time | The amount of time to delay before callback is invoked, in milliseconds. Specify Timeout::Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. | 
| period | The time interval between invocations of callback, in milliseconds. Specify Timeout::Infinite to disable periodic signaling. | 
| ArgumentNullException | The callback is null. | 
| xtd::argument_out_of_range_exception | The due_time or period parameter is negative and is not equal to Timeout::Infinite. | 
| xtd::threading::timer::timer | ( | const timer_callback & | callback, | 
| std::any | state, | ||
| const time_span & | due_time, | ||
| const time_span & | period | ||
| ) | 
Initializes a new instance of the timer class, using a TimaSpan to specify the time interval.
| callback | the address of a method to be executed | 
| state | An object containing information to be used by the callback method, or null. | 
| due_time | The amount of time to delay before callback is invoked, in milliseconds. Specify Timeout::Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. | 
| period | The time interval between invocations of callback, in milliseconds. Specify Timeout::Infinite to disable periodic signaling. | 
| ArgumentNullException | The callback or due_time or period param is null. | 
| xtd::argument_out_of_range_exception | The due_time or period parameter is negative and is not equal to Timeout::Infinite. | 
| xtd::threading::timer::timer | ( | const timer_callback & | callback, | 
| std::any | state, | ||
| uint32 | due_time, | ||
| uint32 | period | ||
| ) | 
Initializes a new instance of the timer class, using a 32-bit unsigned integer to specify the time interval.
| callback | the address of a method to be executed | 
| state | An object containing information to be used by the callback method, or null. | 
| due_time | The amount of time to delay before callback is invoked, in milliseconds. Specify Timeout::Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. | 
| period | The time interval between invocations of callback, in milliseconds. Specify Timeout::Infinite to disable periodic signaling. | 
| ArgumentNullException | The callback is null. | 
| xtd::argument_out_of_range_exception | The due_time or period parameter is negative and is not equal to Timeout::Infinite. | 
changes the start time and the interval between method invocations for a timer, using 32-bit signed integers to measure time intervals.
| due_time | The amount of time to delay before callback is invoked, in milliseconds. Specify Timeout::Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. | 
| period | The time interval between invocations of callback, in milliseconds. Specify Timeout::Infinite to disable periodic signaling. | 
| xtd::argument_out_of_range_exception | The due_time or period parameter is negative and is not equal to Timeout::Infinite. | 
changes the start time and the interval between method invocations for a timer, using 64-bit signed integers to measure time intervals.
| due_time | The amount of time to delay before callback is invoked, in milliseconds. Specify Timeout::Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. | 
| period | The time interval between invocations of callback, in milliseconds. Specify Timeout::Infinite to disable periodic signaling. | 
| xtd::argument_out_of_range_exception | The due_time or period parameter is negative and is not equal to Timeout::Infinite. | 
changes the start time and the interval between method invocations for a timer, using time_span values to measure time intervals.
| due_time | The amount of time to delay before callback is invoked, in milliseconds. Specify Timeout::Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. | 
| period | The time interval between invocations of callback, in milliseconds. Specify Timeout::Infinite to disable periodic signaling. | 
| ArgumentNullException | The due_time or period param is null. | 
| xtd::argument_out_of_range_exception | The due_time or period parameter is negative and is not equal to Timeout::Infinite. | 
changes the start time and the interval between method invocations for a timer, using 32-bit unsigned integers to measure time intervals.
| due_time | The amount of time to delay before callback is invoked, in milliseconds. Specify Timeout::Infinite to prevent the timer from starting. Specify zero (0) to start the timer immediately. | 
| period | The time interval between invocations of callback, in milliseconds. Specify Timeout::Infinite to disable periodic signaling. | 
| xtd::argument_out_of_range_exception | The due_time or period parameter is negative and is not equal to Timeout::Infinite. | 
| void xtd::threading::timer::close | ( | ) | 
Releases all resources used by the current instance of xtd::threading::timer.