Commit 56b43294 authored by unknown's avatar unknown

Portability fixes.

Don't free memory from InnoDB at exit (as this may be done before other threads are finnished)


include/my_pthread.h:
  Added missing prototypes
innobase/srv/srv0start.c:
  Don't free memory at exit (as this may be done before other threads are finnished)
mysys/mf_iocache.c:
  Cleanup (Don't rely on return value from mutex_unlock())
parent 2bdf7fba
...@@ -522,11 +522,13 @@ typedef struct _my_rw_lock_t { ...@@ -522,11 +522,13 @@ typedef struct _my_rw_lock_t {
#define rw_unlock(A) my_rw_unlock((A)) #define rw_unlock(A) my_rw_unlock((A))
#define rwlock_destroy(A) my_rwlock_destroy((A)) #define rwlock_destroy(A) my_rwlock_destroy((A))
extern int my_rwlock_init( my_rw_lock_t *, void * ); extern int my_rwlock_init(my_rw_lock_t *, void *);
extern int my_rwlock_destroy( my_rw_lock_t * ); extern int my_rwlock_destroy(my_rw_lock_t *);
extern int my_rw_rdlock( my_rw_lock_t * ); extern int my_rw_rdlock(my_rw_lock_t *);
extern int my_rw_wrlock( my_rw_lock_t * ); extern int my_rw_wrlock(my_rw_lock_t *);
extern int my_rw_unlock( my_rw_lock_t * ); extern int my_rw_unlock(my_rw_lock_t *);
extern int my_rw_tryrdlock(my_rw_lock_t *);
extern int my_rw_trywrlock(my_rw_lock_t *);
#endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */ #endif /* USE_MUTEX_INSTEAD_OF_RW_LOCKS */
#define GETHOSTBYADDR_BUFF_SIZE 2048 #define GETHOSTBYADDR_BUFF_SIZE 2048
......
...@@ -1351,7 +1351,8 @@ innobase_shutdown_for_mysql(void) ...@@ -1351,7 +1351,8 @@ innobase_shutdown_for_mysql(void)
srv_conc_n_threads); srv_conc_n_threads);
} }
#ifdef NOT_WORKING_YET
ut_free_all_mem(); ut_free_all_mem();
#endif
return((int) DB_SUCCESS); return((int) DB_SUCCESS);
} }
...@@ -468,8 +468,10 @@ static int lock_io_cache(IO_CACHE *info) ...@@ -468,8 +468,10 @@ static int lock_io_cache(IO_CACHE *info)
very beginning, that is returns 1 and does not unlock the mutex. very beginning, that is returns 1 and does not unlock the mutex.
*/ */
if (++(info->share->count)) if (++(info->share->count))
return pthread_mutex_unlock(&info->share->mutex); {
else pthread_mutex_unlock(&info->share->mutex);
return 0;
}
return 1; return 1;
} }
...@@ -479,6 +481,7 @@ static void unlock_io_cache(IO_CACHE *info) ...@@ -479,6 +481,7 @@ static void unlock_io_cache(IO_CACHE *info)
pthread_mutex_unlock(&info->share->mutex); pthread_mutex_unlock(&info->share->mutex);
} }
/* /*
Read from IO_CACHE when it is shared between several threads. Read from IO_CACHE when it is shared between several threads.
It works as follows: when a thread tries to read from a file It works as follows: when a thread tries to read from a file
...@@ -488,6 +491,7 @@ static void unlock_io_cache(IO_CACHE *info) ...@@ -488,6 +491,7 @@ static void unlock_io_cache(IO_CACHE *info)
returns 1, the thread does actual IO and unlock_io_cache(), returns 1, the thread does actual IO and unlock_io_cache(),
which signals all the waiting threads that data is in the buffer. which signals all the waiting threads that data is in the buffer.
*/ */
int _my_b_read_r(register IO_CACHE *info, byte *Buffer, uint Count) int _my_b_read_r(register IO_CACHE *info, byte *Buffer, uint Count)
{ {
my_off_t pos_in_file; my_off_t pos_in_file;
...@@ -1068,7 +1072,8 @@ int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock) ...@@ -1068,7 +1072,8 @@ int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock)
if ((length=(uint) (info->write_pos - info->write_buffer))) if ((length=(uint) (info->write_pos - info->write_buffer)))
{ {
pos_in_file=info->pos_in_file; pos_in_file=info->pos_in_file;
/* if we have append cache, we always open the file with /*
If we have append cache, we always open the file with
O_APPEND which moves the pos to EOF automatically on every write O_APPEND which moves the pos to EOF automatically on every write
*/ */
if (!append_cache && info->seek_not_done) if (!append_cache && info->seek_not_done)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment