summaryrefslogtreecommitdiffstats
path: root/src/H5FDvfd_swmr_instr.c
blob: da623511550fe9aa34eea0f1d38e2ad0f6c002e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 * Copyright by The HDF Group.                                               *
 * All rights reserved.                                                      *
 *                                                                           *
 * This file is part of HDF5.  The full HDF5 copyright notice, including     *
 * terms governing use, modification, and redistribution, is contained in    *
 * the COPYING file, which can be found at the root of the source code       *
 * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.  *
 * If you do not have access to either file, you may request a copy from     *
 * help@hdfgroup.org.                                                        *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#include "H5private.h"  /* H5_ATTR_UNUSED */
#include "H5Fpublic.h"
#include "H5FDvfd_swmr.h"

/* vfd_swmr_writer_may_increase_tick_to() and
 * vfd_swmr_reader_did_increase_tick_to() are instrumentation points for
 * VFD SWMR tests to use to coordinate the tick-number increases
 * on a single writer with the progress of a single reader.
 *
 * This file provides the default, do-nothing implementations for both
 * instrumentation routines.
 *
 * A VFD SWMR writer calls vfd_swmr_writer_may_increase_tick_to() with the
 * increased tick number that it proposes, `tick_num`.  The argument
 * `wait_for_reader` tells whether or not the writer can wait for the reader
 * before increasing its tick number.  If `true`, then
 * vfd_swmr_writer_may_increase_tick_to() should
 * block until the reader is finished using the shadow-file content
 * from ticks `tick_num - max_lag` and before, returning `true`.
 * If `false`, then 
 * vfd_swmr_writer_may_increase_tick_to() immediately return `true` if
 * the new tick number does permissible, otherwise `false`.
 *
 * After a VFD SWMR reader increases its tick number, it calls
 * vfd_swmr_reader_did_increase_tick_to() with the new tick number.
 *
 * The test programs test/vfd_swmr_zoo_{reader,writer} provide
 * their own vfd_swmr_writer_may_increase_tick_to() and
 * vfd_swmr_reader_did_increase_tick_to() implementations that override the
 * ones in the library.  In the "zoo"
 * test (test/vfd_swmr_zoo_{reader,writer}), the reader and the writer
 * use a shared file to coordinate tick-number increases so that the writer
 * can call H5Fvfd_swmr_end_tick() to increase its tick number at an arbitrary
 * rate without outrunning the reader.
 */
bool
vfd_swmr_writer_may_increase_tick_to(uint64_t H5_ATTR_UNUSED tick_num,
    bool H5_ATTR_UNUSED wait_for_reader)
{
    return true;
}

void
vfd_swmr_reader_did_increase_tick_to(uint64_t H5_ATTR_UNUSED tick_num)
{
    return;
}