#include "stdint.h"
#include <stdlib.h>
#include "dn_additional.h"
#include "dn_common.h"
#include "dn_thread.h"
Go to the source code of this file.
Functions | |
HRESULT | create_event (EVENT *pevt, int reset_mode, int init_signal) |
Creates a event object. | |
HRESULT | destroy_event (EVENT *pevt) |
Destroys a event object. | |
uint32_t | gettimeofday_msec () |
Gets the current time value [ms]. | |
HRESULT | initialize_mutex (MUTEX *pmutex) |
Initializes mutex handle. | |
HRESULT | lock_mutex (MUTEX *pmutex, uint32_t timeout) |
Locks mutex handle. | |
HRESULT | release_mutex (MUTEX *pmutex) |
Releases mutex handle. | |
HRESULT | reset_event (EVENT *pevt) |
Resets a event. | |
HRESULT | set_event (EVENT *pevt) |
Sets a event. | |
HRESULT | unlock_mutex (MUTEX *pmutex) |
Unlocks mutex handle. | |
HRESULT | wait_event (EVENT *pevt, uint32_t timeout) |
Waits a event. | |
HRESULT | wait_event_multi (EVENT **pevt, uint32_t count, uint32_t timeout, int wait_all) |
Waits multiple events. |
HRESULT create_event | ( | EVENT * | pevt, |
int | reset_mode, | ||
int | init_signal | ||
) |
Creates a event object.
[in,out] | pevt | The pointer of event object to be created. |
[in] | reset_mode | If (reset_mode != 0) then the event object is set manual reset mode, else auto reset mode. |
[in] | init_signal | If (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.
[in,out] | pevt | The pointer of event object to be destroyed. |
Definition at line 251 of file dn_thread.c.
Gets the current time value [ms].
Definition at line 589 of file dn_thread.c.
HRESULT initialize_mutex | ( | MUTEX * | pmutex | ) |
Initializes mutex handle.
[in,out] | pmutex | The 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.
[in,out] | pmutex | The 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.
[in,out] | pmutex | The pointer of mutex handle to be locked. |
[in] | timeout | Timeout value. |
Definition at line 145 of file dn_thread.c.
HRESULT release_mutex | ( | MUTEX * | pmutex | ) |
Releases mutex handle.
[in,out] | pmutex | The pointer of mutex handle to be released. |
Definition at line 108 of file dn_thread.c.
HRESULT reset_event | ( | EVENT * | pevt | ) |
Resets a event.
[in,out] | pevt | The pointer of event object to be reset. |
Definition at line 328 of file dn_thread.c.
Sets a event.
[in,out] | pevt | The pointer of event object to be set. |
Definition at line 295 of file dn_thread.c.
HRESULT unlock_mutex | ( | MUTEX * | pmutex | ) |
Unlocks mutex handle.
[in,out] | pmutex | The 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.
[in,out] | pevt | The pointer of event object to be waited. |
[in] | timeout | Timeout 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.
[in,out] | pevt | The pointer of event objects to be waited. |
[in] | count | The number of event objects. |
[in] | timeout | Timeout value. |
[in] | wait_all | If (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.