diff options
| author | sasha@mysql.sashanet.com <> | 2001-11-03 16:55:39 -0700 |
|---|---|---|
| committer | sasha@mysql.sashanet.com <> | 2001-11-03 16:55:39 -0700 |
| commit | 4f106fe87ef9352d533c66c26f6cc0cac578cc73 (patch) | |
| tree | 898c9eb0d6079d4565f4695e60ea37a139046455 /include | |
| parent | 2050505fb423699fc8e048ea130fd6a313bfba05 (diff) | |
| parent | b00eee622e6d7eb2de56f7c4f61ae75faf95b4dc (diff) | |
| download | mariadb-git-4f106fe87ef9352d533c66c26f6cc0cac578cc73.tar.gz | |
Merge work:/home/bk/mysql-4.0
into mysql.sashanet.com:/home/sasha/src/bk/mysql-4.0
Diffstat (limited to 'include')
| -rw-r--r-- | include/my_sys.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/include/my_sys.h b/include/my_sys.h index f6d303a6ccb..5174425006d 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -293,6 +293,16 @@ typedef struct st_dynamic_string { struct st_io_cache; typedef int (*IO_CACHE_CALLBACK)(struct st_io_cache*); +#ifdef THREAD +#define lock_append_buffer(info) \ + pthread_mutex_lock(&(info)->append_buffer_lock) +#define unlock_append_buffer(info) \ + pthread_mutex_unlock(&(info)->append_buffer_lock) +#else +#define lock_append_buffer(info) +#define unlock_append_buffer(info) +#endif + typedef struct st_io_cache /* Used when cacheing files */ { my_off_t pos_in_file,end_of_file; @@ -301,7 +311,7 @@ typedef struct st_io_cache /* Used when cacheing files */ that will use a buffer allocated somewhere else */ - byte *append_buffer, *append_pos, *append_end; + byte *append_buffer, *append_read_pos, *append_write_pos, *append_end; /* for append buffer used in READ_APPEND cache */ #ifdef THREAD pthread_mutex_t append_buffer_lock; @@ -348,10 +358,15 @@ typedef int (*qsort2_cmp)(const void *, const void *, const void *); _my_b_get(info)) #define my_b_write(info,Buffer,Count) \ + ((info)->type != SEQ_READ_APPEND) ? (\ ((info)->rc_pos + (Count) <= (info)->rc_end ?\ (memcpy((info)->rc_pos,Buffer,(size_t) (Count)), \ ((info)->rc_pos+=(Count)),0) :\ - _my_b_write(info,Buffer,Count)) + _my_b_write(info,Buffer,Count))) : \ + ((info)->append_write_pos + (Count) <= (info)->append_end ?\ + (memcpy((info)->append_write_pos,Buffer,(size_t)Count), \ + ((info)->append_write_pos+=(Count),0)) : \ + _my_b_append(info,Buffer,Count)) /* my_b_write_byte dosn't have any err-check */ #define my_b_write_byte(info,chr) \ @@ -564,6 +579,7 @@ extern int _my_b_net_read(IO_CACHE *info,byte *Buffer,uint Count); extern int _my_b_get(IO_CACHE *info); extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count); extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count); +extern int _my_b_append(IO_CACHE *info,const byte *Buffer,uint Count); extern int my_block_write(IO_CACHE *info, const byte *Buffer, uint Count, my_off_t pos); extern int flush_io_cache(IO_CACHE *info); |
