Path: blob/master/waterbox/libc/functions/stdio/ftrylockfile.c
2 views
/* ftrylockfile( FILE * )12This file is part of the Public Domain C Library (PDCLib).3Permission is granted to use, modify, and / or redistribute at will.4*/56#include <stdio.h>7#include <stdarg.h>89#ifndef REGTEST10#include "_PDCLIB_io.h"11#include <threads.h>12#include <stdlib.h>1314int _PDCLIB_ftrylockfile( FILE * file )15{16int res = mtx_trylock( &file->lock );17switch(res) {18case thrd_success:19return 0;20case thrd_busy:21return 1;2223default:24abort();25}26}2728#endif2930#ifdef TEST31#include "_PDCLIB_test.h"3233int main( void )34{35// Not tested here - tested by other stdio test drivers36return TEST_RESULTS;37}3839#endif404142