[NeXus-tech] NAPI Thread safety

freddie.akeroyd at stfc.ac.uk freddie.akeroyd at stfc.ac.uk
Mon Oct 18 12:33:01 BST 2010


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? 

Regards,

Freddie
-- 
Scanned by iCritical.



More information about the NeXus-tech mailing list