summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <tsmith@quadxeon.mysql.com>2007-05-30 23:46:21 +0200
committerunknown <tsmith@quadxeon.mysql.com>2007-05-30 23:46:21 +0200
commit7d06ed82817833b71a3c823d55e319261e623294 (patch)
tree2d13959729432f2a363a7356ea813e9bd638c1e5 /mysys
parent1835c8bf80a00ec58d55149a79bfd605956fa1b3 (diff)
parent06297270880ca0f0023c66ca90291665ec3aacc2 (diff)
downloadmariadb-git-7d06ed82817833b71a3c823d55e319261e623294.tar.gz
Merge quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/50
into quadxeon.mysql.com:/benchmarks/ext3/TOSAVE/tsmith/bk/maint/50 strings/strtod.c: Auto merged
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_seek.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/mysys/my_seek.c b/mysys/my_seek.c
index 2be4812a2bd..3d415400aa2 100644
--- a/mysys/my_seek.c
+++ b/mysys/my_seek.c
@@ -23,7 +23,9 @@
my_off_t pos The expected position (absolute or relative)
int whence A direction parameter and one of
{SEEK_SET, SEEK_CUR, SEEK_END}
- myf MyFlags Not used.
+ myf MyFlags MY_THREADSAFE must be set in case my_seek may be mixed
+ with my_pread/my_pwrite calls and fd is shared among
+ threads.
DESCRIPTION
The my_seek function is a wrapper around the system call lseek and
@@ -54,9 +56,16 @@ my_off_t my_seek(File fd, my_off_t pos, int whence,
Make sure we are using a valid file descriptor!
*/
DBUG_ASSERT(fd != -1);
-
- newpos= lseek(fd, pos, whence);
-
+#if defined(THREAD) && !defined(HAVE_PREAD)
+ if (MyFlags & MY_THREADSAFE)
+ {
+ pthread_mutex_lock(&my_file_info[fd].mutex);
+ newpos= lseek(fd, pos, whence);
+ pthread_mutex_unlock(&my_file_info[fd].mutex);
+ }
+ else
+#endif
+ newpos= lseek(fd, pos, whence);
if (newpos == (os_off_t) -1)
{
my_errno=errno;