diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-03-22 22:32:55 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2022-03-25 13:11:12 +0200 |
commit | 54398c1583f18ef9daf1a9227691b14c3b7f4212 (patch) | |
tree | a172cf3f6ebc881f5b0ac9e7235e140c4ddebe1f /src | |
parent | 074fa98ac4ea903049ba9d7386cdb2f050ea3b48 (diff) |
libcamera: base: timer: Drop start() overload with int argument
The start(unsigned int msec) overload is error-prone, as the argument
unit can easily be mistaken in callers. Drop it and update all callers
to use the start(std::chrono::milliseconds) overload instead.
The callers now need to use std::chrono_literals. The using statement
could be added to timer.h for convenience, but "using" is discouraged in
header files to avoid namespace pollution. Update the callers instead,
and while at it, sort the "using" statements alphabetically in tests.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Umang Jain <umang.jain@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libcamera/base/timer.cpp | 10 | ||||
-rw-r--r-- | src/libcamera/ipc_pipe_unixsocket.cpp | 4 |
2 files changed, 3 insertions, 11 deletions
diff --git a/src/libcamera/base/timer.cpp b/src/libcamera/base/timer.cpp index 187336e3..74b060af 100644 --- a/src/libcamera/base/timer.cpp +++ b/src/libcamera/base/timer.cpp @@ -63,16 +63,6 @@ Timer::~Timer() } /** - * \fn Timer::start(unsigned int msec) - * \brief Start or restart the timer with a timeout of \a msec - * \param[in] msec The timer duration in milliseconds - * - * If the timer is already running it will be stopped and restarted. - * - * \context This function is \threadbound. - */ - -/** * \brief Start or restart the timer with a timeout of \a duration * \param[in] duration The timer duration in milliseconds * diff --git a/src/libcamera/ipc_pipe_unixsocket.cpp b/src/libcamera/ipc_pipe_unixsocket.cpp index 3ef90709..da2cffc3 100644 --- a/src/libcamera/ipc_pipe_unixsocket.cpp +++ b/src/libcamera/ipc_pipe_unixsocket.cpp @@ -18,6 +18,8 @@ #include "libcamera/internal/ipc_unixsocket.h" #include "libcamera/internal/process.h" +using namespace std::chrono_literals; + namespace libcamera { LOG_DECLARE_CATEGORY(IPCPipe) @@ -126,7 +128,7 @@ int IPCPipeUnixSocket::call(const IPCUnixSocket::Payload &message, } /* \todo Make this less dangerous, see IPCPipe::sendSync() */ - timeout.start(2000); + timeout.start(2000ms); while (!iter->second.done) { if (!timeout.isRunning()) { LOG(IPCPipe, Error) << "Call timeout!"; |