1 : // Copyright 2014 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 :
15 : #ifndef SYZYGY_KASKO_WAITABLE_TIMER_H_
16 : #define SYZYGY_KASKO_WAITABLE_TIMER_H_
17 :
18 : #include <windows.h>
19 :
20 : namespace kasko {
21 :
22 : // Defines an interface for a timer that can be used with the Windows wait
23 : // functions (WaitForSingleObject, WaitForMultipleObjects, etc.). The wait
24 : // interval is determined by the implementation.
25 : class WaitableTimer {
26 : public:
27 E : virtual ~WaitableTimer() {}
28 :
29 : // Starts the timer.
30 : virtual void Start() = 0;
31 :
32 : // Returns a HANDLE that will be signaled when the timer completes.
33 : // @returns an automatically resetting HANDLE compatible with the Windows wait
34 : // functions.
35 : virtual HANDLE GetHANDLE() = 0;
36 : };
37 :
38 : } // namespace kasko
39 :
40 : #endif // SYZYGY_KASKO_WAITABLE_TIMER_H_
|