blob: 0c25dfeb2be62e3e9c4f4ad441eb6c6184a25b7d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
|
#include <__stdio.h>
#include <stdatomic.h>
#include <stddef.h>
#include <stdio.h>
int ftrylockfile(struct __FILE *file)
{
if (file == NULL)
return -1;
return atomic_flag_test_and_set_explicit(&file->lock, memory_order_acquire) ? 1 : 0;
}
|