Convert-Binary-C
view release on metacpan or search on metacpan
tests/include/pdclib/platform/example/functions/threads/mtx_trylock.c view on Meta::CPAN
/* mtx_trylock( mtx_t * )
This file is part of the Public Domain C Library (PDCLib).
Permission is granted to use, modify, and / or redistribute at will.
*/
#ifndef REGTEST
#include <threads.h>
#include "/usr/include/errno.h"
#ifdef __cplusplus
extern "C" {
#endif
/* Implicity casting the parameter. */
extern int pthread_mutex_trylock( mtx_t * );
#ifdef __cplusplus
}
#endif
int mtx_trylock( mtx_t * mtx )
{
switch ( pthread_mutex_trylock( mtx ) )
{
case 0:
return thrd_success;
case EBUSY:
return thrd_busy;
default:
return thrd_error;
}
}
#endif
#ifdef TEST
#include "_PDCLIB_test.h"
int main( void )
{
#ifndef REGTEST
TESTCASE( NO_TESTDRIVER );
#endif
return TEST_RESULTS;
}
#endif
( run in 0.569 second using v1.01-cache-2.11-cpan-39bf76dae61 )