diff options
author | Bill Wendling <wendling@ncsa.uiuc.edu> | 2000-05-19 22:02:24 (GMT) |
---|---|---|
committer | Bill Wendling <wendling@ncsa.uiuc.edu> | 2000-05-19 22:02:24 (GMT) |
commit | b97c63cdbcdcf3f575aedfbfb3b2e00e2a28be60 (patch) | |
tree | d817141cf75aad516b6f8571eff324eddb7247ad /src/H5TSprivate.h | |
parent | fb75b8a89ce45af2ac6c14ed31ffc884b0d0fc88 (diff) | |
download | hdf5-b97c63cdbcdcf3f575aedfbfb3b2e00e2a28be60.zip hdf5-b97c63cdbcdcf3f575aedfbfb3b2e00e2a28be60.tar.gz hdf5-b97c63cdbcdcf3f575aedfbfb3b2e00e2a28be60.tar.bz2 |
[svn-r2286] Gave the threading functions return types (herr_t). pthreads' calls
return 0 on success and non-zero on failure. That's what happens with
these calls.
There was a problem compiling threading on Linux. The pthread_t type is
not consistent among different implementations, so it cannot simply be
assigned to NULL or tested against it. I initialize it by calling
HDmemset(foo_thread, 0, sizeof(pthread_t)). To see if it's a "null"
pthread, I created a special pthread_t object (assigned to only in the
init phase and then only read...i.e., thread safe) and assigned it "null"
as above. Then I use pthread_equal() to determine if the thread is null.
Diffstat (limited to 'src/H5TSprivate.h')
-rw-r--r-- | src/H5TSprivate.h | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/H5TSprivate.h b/src/H5TSprivate.h index 601b6f0..525450c 100644 --- a/src/H5TSprivate.h +++ b/src/H5TSprivate.h @@ -14,8 +14,8 @@ * *------------------------------------------------------------------------- */ -#ifndef _H5TSprivate_H -#define _H5TSprivate_H +#ifndef H5TSprivate_H_ +#define H5TSprivate_H_ /* Public headers needed by this file */ #ifdef LATER @@ -25,10 +25,10 @@ /* Library level data structures */ typedef struct H5TS_mutex_struct { - pthread_t owner_thread; /* current lock owner */ - pthread_mutex_t atomic_lock; /* lock for atomicity of new mechanism */ - pthread_cond_t cond_var; /* condition variable */ - unsigned int lock_count; + pthread_t owner_thread; /* current lock owner */ + pthread_mutex_t atomic_lock; /* lock for atomicity of new mechanism */ + pthread_cond_t cond_var; /* condition variable */ + unsigned int lock_count; } H5TS_mutex_t; /* Extern global variables */ @@ -38,17 +38,16 @@ extern pthread_key_t H5TS_errstk_key_g; #if defined c_plusplus || defined __cplusplus extern "C" { -#endif /* c_plusplus || __cplusplus */ +#endif /* c_plusplus || __cplusplus */ __DLL__ void H5TS_first_thread_init(void); -__DLL__ void H5TS_mutex_lock(H5TS_mutex_t *mutex); -__DLL__ void H5TS_mutex_unlock(H5TS_mutex_t *mutex); -__DLL__ void H5TS_cancel_count_inc(void); -__DLL__ void H5TS_cancel_count_dec(void); +__DLL__ herr_t H5TS_mutex_lock(H5TS_mutex_t *mutex); +__DLL__ herr_t H5TS_mutex_unlock(H5TS_mutex_t *mutex); +__DLL__ herr_t H5TS_cancel_count_inc(void); +__DLL__ herr_t H5TS_cancel_count_dec(void); #if defined c_plusplus || defined __cplusplus } -#endif /* c_plusplus || __cplusplus */ - -#endif /* _H5TSprivate_H */ +#endif /* c_plusplus || __cplusplus */ +#endif /* H5TSprivate_H_ */ |