diff options
author | MySQL Team <mysql@php.net> | 2001-01-23 16:48:50 +0000 |
---|---|---|
committer | MySQL Team <mysql@php.net> | 2001-01-23 16:48:50 +0000 |
commit | 800f555b707c696798877c80352ded46289e87c4 (patch) | |
tree | c540242b6e6da4e9b99b46797a26b215abef0a64 /ext/mysql/libmysql/thr_mutex.c | |
parent | d36858681a0d48414702524ebd16f31289b06fa8 (diff) | |
download | php-git-800f555b707c696798877c80352ded46289e87c4.tar.gz |
Upgrade ext/mysql/libmysql to version 3.23.32. One notable bug fix is
that the client can now connect to a server which is using a default
charset other than latin1.
Diffstat (limited to 'ext/mysql/libmysql/thr_mutex.c')
-rw-r--r-- | ext/mysql/libmysql/thr_mutex.c | 30 |
1 files changed, 29 insertions, 1 deletions
diff --git a/ext/mysql/libmysql/thr_mutex.c b/ext/mysql/libmysql/thr_mutex.c index 1c900352cf..a6147b409a 100644 --- a/ext/mysql/libmysql/thr_mutex.c +++ b/ext/mysql/libmysql/thr_mutex.c @@ -53,6 +53,7 @@ int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line) { fprintf(stderr,"safe_mutex: Trying to lock mutex at %s, line %d, when the mutex was already locked at %s, line %d\n", file,line,mp->file,mp->line); + fflush(stderr); abort(); } pthread_mutex_unlock(&mp->global); @@ -61,11 +62,13 @@ int safe_mutex_lock(safe_mutex_t *mp,const char *file, uint line) { fprintf(stderr,"Got error %d when trying to lock mutex at %s, line %d\n", error, file, line); + fflush(stderr); abort(); } if (mp->count++) { fprintf(stderr,"safe_mutex: Error in thread libray: Got mutex at %s, line %d more than 1 time\n", file,line); + fflush(stderr); abort(); } mp->thread=pthread_self(); @@ -84,21 +87,29 @@ int safe_mutex_unlock(safe_mutex_t *mp,const char *file, uint line) { fprintf(stderr,"safe_mutex: Trying to unlock mutex that wasn't locked at %s, line %d\n Last used at %s, line: %d\n", file,line,mp->file ? mp->file : "",mp->line); + fflush(stderr); abort(); } if (!pthread_equal(pthread_self(),mp->thread)) { fprintf(stderr,"safe_mutex: Trying to unlock mutex at %s, line %d that was locked by another thread at: %s, line: %d\n", file,line,mp->file,mp->line); + fflush(stderr); abort(); } mp->count--; +#ifdef __WIN__ + pthread_mutex_unlock(&mp->mutex); + error=0; +#else error=pthread_mutex_unlock(&mp->mutex); if (error) { fprintf(stderr,"safe_mutex: Got error: %d when trying to unlock mutex at %s, line %d\n", error, file, line); + fflush(stderr); abort(); } +#endif /* __WIN__ */ pthread_mutex_unlock(&mp->global); return error; } @@ -112,12 +123,14 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file, if (mp->count == 0) { fprintf(stderr,"safe_mutex: Trying to cond_wait on a unlocked mutex at %s, line %d\n",file,line); + fflush(stderr); abort(); } if (!pthread_equal(pthread_self(),mp->thread)) { fprintf(stderr,"safe_mutex: Trying to cond_wait on a mutex at %s, line %d that was locked by another thread at: %s, line: %d\n", file,line,mp->file,mp->line); + fflush(stderr); abort(); } @@ -125,6 +138,7 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file, { fprintf(stderr,"safe_mutex: Count was %d on locked mutex at %s, line %d\n", mp->count+1, file, line); + fflush(stderr); abort(); } pthread_mutex_unlock(&mp->global); @@ -133,6 +147,7 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file, if (error) { fprintf(stderr,"safe_mutex: Got error: %d when doing a safe_mutex_wait at %s, line %d\n", error, file, line); + fflush(stderr); abort(); } if (mp->count++) @@ -140,6 +155,7 @@ int safe_cond_wait(pthread_cond_t *cond, safe_mutex_t *mp, const char *file, fprintf(stderr, "safe_mutex: Count was %d in thread %lx when locking mutex at %s, line %d\n", mp->count-1, my_thread_id(), file, line); + fflush(stderr); abort(); } mp->thread=pthread_self(); @@ -159,6 +175,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, if (mp->count != 1 || !pthread_equal(pthread_self(),mp->thread)) { fprintf(stderr,"safe_mutex: Trying to cond_wait at %s, line %d on a not hold mutex\n",file,line); + fflush(stderr); abort(); } mp->count--; /* Mutex will be released */ @@ -176,6 +193,7 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, fprintf(stderr, "safe_mutex: Count was %d in thread %lx when locking mutex at %s, line %d (error: %d)\n", mp->count-1, my_thread_id(), file, line, error); + fflush(stderr); abort(); } mp->thread=pthread_self(); @@ -187,14 +205,24 @@ int safe_cond_timedwait(pthread_cond_t *cond, safe_mutex_t *mp, int safe_mutex_destroy(safe_mutex_t *mp, const char *file, uint line) { + int error=0; if (mp->count != 0) { fprintf(stderr,"safe_mutex: Trying to destroy a mutex that was locked at %s, line %d at %s, line %d\n", mp->file,mp->line, file, line); + fflush(stderr); abort(); } +#ifdef __WIN__ pthread_mutex_destroy(&mp->global); - return pthread_mutex_destroy(&mp->mutex); + pthread_mutex_destroy(&mp->mutex); +#else + if (pthread_mutex_destroy(&mp->global)) + error=1; + if (pthread_mutex_destroy(&mp->mutex)) + error=1; +#endif + return error; } #endif /* THREAD && SAFE_MUTEX */ |