docs/html/Event_8h_source.html
| | Jetson Inference
DNN Vision Library |
Event.h
Go to the documentation of this file.
1 /*
2 * Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22
23 #ifndef __MULTITHREAD_EVENT_H_
24 #define __MULTITHREAD_EVENT_H_
25
26 #include "Mutex.h"
27 #include "timespec.h"
28
34 {
35 public:
40inline Event( bool auto_reset=true );
41
45inline ~Event();
46
50inline void Wake();
51
55inline void Reset();
56
61inline bool Query();
62
67inline bool Wait();
68
73inline bool Wait( const timespec& timeout );
74
79inline bool Wait( uint64_t timeout );
80
85inline bool WaitNs( uint64_t timeout );
86
91inline bool WaitUs( uint64_t timeout );
92
96inline pthread_cond_t* GetID();
97
98 protected:
99
101
104boolmAutoReset;
105 };
106
107 // inline implementations
108 #include "Event.inl"
109
110 #endif
bool Wait()
Wait until this event is raised.
Event object for signalling other threads.
Definition: Event.h:33
bool Query()
Query the status of this event.
bool WaitNs(uint64_t timeout)
Wait for a specified number of nanoseconds until this event is raised or timeout occurs.
A lightweight mutual exclusion lock.
Definition: Mutex.h:35
pthread_cond_t mID
Definition: Event.h:100
void Wake()
Raise the event.
bool mAutoReset
Definition: Event.h:104
void Reset()
Reset the event status to un-raised.
Event(bool auto_reset=true)
Event constructor.
Mutex mQueryMutex
Definition: Event.h:102
bool WaitUs(uint64_t timeout)
Wait for a specified number of microseconds until this event is raised or timeout occurs.
pthread_cond_t * GetID()
Get the Event object.
~Event()
Destructor.
bool mQuery
Definition: Event.h:103