Symbian platform (C++)
SDK native APIs, runtime and tooling
Loading...
Searching...
No Matches
native_timer.h
Go to the documentation of this file.
1// Copyright 2026 The Symbian SDK Authors.
2// Licensed under the Apache License, Version 2.0.
3// Thread-relative RTimer ownership for a single event-thread request pump.
4
5#ifndef SYMBIAN_CONCURRENCY_NATIVE_TIMER_H_
6#define SYMBIAN_CONCURRENCY_NATIVE_TIMER_H_
7
8#if __has_include(<symbian/runtime.h>)
9#include <symbian/runtime.h>
10#else
11#include "abi.h"
12#endif
13
14namespace symbian::concurrency {
15
17 public:
18 NativeTimer() = default;
19 NativeTimer(const NativeTimer&) = delete;
21
23
24 // Create, arm, inspect and close on the same OS thread. A timer may be
25 // rearmed only after its previous status has completed.
26 int Open() {
27 if (state_ != nullptr) {
28 return -11; // KErrAlreadyExists.
29 }
30 return SymbianRuntimeTimerCreate(&state_);
31 }
32
35 }
36
38
39 int Result() const { return SymbianRuntimeTimerResult(state_); }
40
41 bool IsReady() const { return SymbianRuntimeTimerIsReady(state_); }
42
43 void Close() {
44 if (state_ == nullptr) {
45 return;
46 }
48 state_ = nullptr;
49 }
50
51 private:
52 SymbianRuntimeTimerState* state_ = nullptr;
53};
54
55} // namespace symbian::concurrency
56
57#endif // SYMBIAN_CONCURRENCY_NATIVE_TIMER_H_
bool SymbianRuntimeTimerIsReady(const SymbianRuntimeTimerState *state)
Definition sdk_timer.cc:59
int SymbianRuntimeTimerResult(const SymbianRuntimeTimerState *state)
Definition sdk_timer.cc:51
int SymbianRuntimeTimerCreate(SymbianRuntimeTimerState **state)
Definition sdk_timer.cc:11
void SymbianRuntimeTimerClose(SymbianRuntimeTimerState *state)
Definition sdk_timer.cc:64
void SymbianRuntimeTimerCancel(SymbianRuntimeTimerState *state)
Definition sdk_timer.cc:45
int SymbianRuntimeTimerStart(SymbianRuntimeTimerState *state, int microseconds)
Definition sdk_timer.cc:31
Definition bounded_channel.h:38
Definition native_timer.h:16
int Open()
Definition native_timer.h:26
NativeTimer & operator=(const NativeTimer &)=delete
~NativeTimer()
Definition native_timer.h:22
int Start(int microseconds)
Definition native_timer.h:33
void Close()
Definition native_timer.h:43
bool IsReady() const
Definition native_timer.h:41
NativeTimer(const NativeTimer &)=delete
void Cancel()
Definition native_timer.h:37
int Result() const
Definition native_timer.h:39
Definition bounded_channel.h:32
Definition sdk_timer.cc:5