Macros | Functions
dn_thread.h File Reference

Thread and mutex API file. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define _DN_EXP_THREAD
 
#define calc_time_diff(start, end)   (((end) >= (start)) ? ((end) - (start)) : ((((uint32_t)-1) - (end)) + (start)))
 A macro that calculates the time difference between start and end. More...
 
#define INFINITE   ((uint32_t)-1)
 A definition for infinite wait. More...
 

Functions

_DN_EXP_THREAD HRESULT create_event (EVENT *pevt, int reset_mode, int init_signal)
 Creates a event object. More...
 
_DN_EXP_THREAD HRESULT destroy_event (EVENT *pevt)
 Destroys a event object. More...
 
_DN_EXP_THREAD uint32_t gettimeofday_msec ()
 Gets the current time value [ms]. More...
 
_DN_EXP_THREAD HRESULT initialize_mutex (MUTEX *pmutex)
 Initializes mutex handle. More...
 
_DN_EXP_THREAD HRESULT lock_mutex (MUTEX *pmutex, uint32_t timeout)
 Locks mutex handle. More...
 
_DN_EXP_THREAD HRESULT release_mutex (MUTEX *pmutex)
 Releases mutex handle. More...
 
_DN_EXP_THREAD HRESULT reset_event (EVENT *pevt)
 Resets a event. More...
 
_DN_EXP_THREAD HRESULT set_event (EVENT *pevt)
 Sets a event. More...
 
_DN_EXP_THREAD HRESULT unlock_mutex (MUTEX *pmutex)
 Unlocks mutex handle. More...
 
_DN_EXP_THREAD HRESULT wait_event (EVENT *pevt, uint32_t timeout)
 Waits a event. More...
 
_DN_EXP_THREAD HRESULT wait_event_multi (EVENT **pevt, uint32_t count, uint32_t timeout, int wait_all)
 Waits multiple events. More...
 

Detailed Description

Thread and mutex API file.

Defines thread and mutex APIs.

Version
1.2
Date
2014/11/06
2014/12/19 Adds wait_event_multi function.
2015/11/10 Bug fix. Solve the deadlock on wait_event in Linux.
Author
DENSO WAVE

Software License Agreement (MIT License)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Definition in file dn_thread.h.

Macro Definition Documentation

#define _DN_EXP_THREAD

Definition at line 39 of file dn_thread.h.

#define calc_time_diff (   start,
  end 
)    (((end) >= (start)) ? ((end) - (start)) : ((((uint32_t)-1) - (end)) + (start)))

A macro that calculates the time difference between start and end.

Parameters
[in]startThe start time [ms].
[in]endThe end time [ms].

Definition at line 199 of file dn_thread.h.

#define INFINITE   ((uint32_t)-1)

A definition for infinite wait.

Definition at line 95 of file dn_thread.h.

Function Documentation

HRESULT create_event ( EVENT pevt,
int  reset_mode,
int  init_signal 
)

Creates a event object.

Parameters
[in,out]pevtThe pointer of event object to be created.
[in]reset_modeIf (reset_mode != 0) then the event object is set manual reset mode, else auto reset mode.
[in]init_signalIf (init_signal != 0) then the event object is signaled at first, else non signaled.

Definition at line 220 of file dn_thread.c.

HRESULT destroy_event ( EVENT pevt)

Destroys a event object.

Parameters
[in,out]pevtThe pointer of event object to be destroyed.
Note
Must not be reused until it is recreated.

Definition at line 251 of file dn_thread.c.

uint32_t gettimeofday_msec ( )

Gets the current time value [ms].

Definition at line 589 of file dn_thread.c.

HRESULT initialize_mutex ( MUTEX pmutex)

Initializes mutex handle.

Parameters
[in,out]pmutexThe pointer of mutex handle to be initialized.

Software License Agreement (MIT License)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Parameters
[in,out]pmutexThe pointer of mutex handle to be initialized.

Definition at line 80 of file dn_thread.c.

HRESULT lock_mutex ( MUTEX pmutex,
uint32_t  timeout 
)

Locks mutex handle.

Parameters
[in,out]pmutexThe pointer of mutex handle to be locked.
[in]timeoutTimeout value.

Definition at line 145 of file dn_thread.c.

HRESULT release_mutex ( MUTEX pmutex)

Releases mutex handle.

Parameters
[in,out]pmutexThe pointer of mutex handle to be released.
Note
Must not be reused until it is reinitialized

Definition at line 108 of file dn_thread.c.

HRESULT reset_event ( EVENT pevt)

Resets a event.

Parameters
[in,out]pevtThe pointer of event object to be reset.

Definition at line 328 of file dn_thread.c.

HRESULT set_event ( EVENT pevt)

Sets a event.

Parameters
[in,out]pevtThe pointer of event object to be set.

Definition at line 295 of file dn_thread.c.

HRESULT unlock_mutex ( MUTEX pmutex)

Unlocks mutex handle.

Parameters
[in,out]pmutexThe pointer of mutex handle to be unlocked.

Definition at line 188 of file dn_thread.c.

HRESULT wait_event ( EVENT pevt,
uint32_t  timeout 
)

Waits a event.

Parameters
[in,out]pevtThe pointer of event object to be waited.
[in]timeoutTimeout value.

Definition at line 361 of file dn_thread.c.

HRESULT wait_event_multi ( EVENT **  pevt,
uint32_t  count,
uint32_t  timeout,
int  wait_all 
)

Waits multiple events.

Parameters
[in,out]pevtThe pointer of event objects to be waited.
[in]countThe number of event objects.
[in]timeoutTimeout value.
[in]wait_allIf (wait_all != 0) then waits until all event objects are signaled, else waits until a event object is signaled.

Definition at line 478 of file dn_thread.c.



bcap_core
Author(s): DENSO WAVE INCORPORATED
autogenerated on Mon Jun 10 2019 13:12:20