[NeXus-tech] NAPI Thread safety

Mark Koennecke Mark.Koennecke at psi.ch
Mon Oct 18 12:49:14 BST 2010


Hi,

freddie.akeroyd at stfc.ac.uk wrote:
> Hi,
>
> In the HDF5 thread examples H5Fopen() is called once and the fid_t
> returned used by separate threads - as NXhandle contains state
> information it is not possible to share it between threads so I think we
> need to either:
> (1) add an NXclone_handle() / NXcopy_handle() function to create a copy
> of an NXhandle connected to the same HDF5 file via H5Freopen() 
> or
> (2) Modify NXopen() so it keeps internally a list of open files and
> associated HDF5 file handles so if you open a file a second time in the
> same process it uses H5Freopen() rather than H5Fopen() to generate the
> NXhandle.
>
> (1) is easier to code; (2) is easier for the end user, but we need to be
> careful about correctly identifying if a file is already open (e.g.
> handling links - is just checking the inode number field returned by
> stat() enough for all cases?)   
>
> Any thoughts? 
>
>   
I am for NXclone_handle. The second version gets just to complex if
our current scheme for following external links gets extended to
more URL types. As you said it may be difficult even to figure out if two
path refer to the same file.

Regards,

    Mark\


> Regards,
>
> Freddie
>   



More information about the NeXus-tech mailing list