You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by bj...@apache.org on 2001/12/30 15:30:58 UTC
cvs commit: apr/include/arch/os2 fileio.h
bjh 01/12/30 06:30:58
Modified: file_io/os2 open.c readwrite.c
include/arch/os2 fileio.h
Log:
OS/2: switch buffered file I/O over to using apr_thread_mutex_t instead of
apr_lock_t.
Revision Changes Path
1.47 +2 -3 apr/file_io/os2/open.c
Index: open.c
===================================================================
RCS file: /home/cvs/apr/file_io/os2/open.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- open.c 29 Dec 2001 23:14:21 -0000 1.46
+++ open.c 30 Dec 2001 14:30:58 -0000 1.47
@@ -99,8 +99,7 @@
if (dafile->buffered) {
dafile->buffer = apr_palloc(cntxt, APR_FILE_BUFSIZE);
- rv = apr_lock_create(&dafile->mutex, APR_MUTEX, APR_INTRAPROCESS,
- APR_LOCK_DEFAULT, NULL, cntxt);
+ rv = apr_thread_mutex_create(&dafile->mutex, 0, cntxt);
if (rv)
return rv;
@@ -173,7 +172,7 @@
}
if (file->buffered)
- apr_lock_destroy(file->mutex);
+ apr_thread_mutex_destroy(file->mutex);
return APR_SUCCESS;
}
1.47 +4 -4 apr/file_io/os2/readwrite.c
Index: readwrite.c
===================================================================
RCS file: /home/cvs/apr/file_io/os2/readwrite.c,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- readwrite.c 28 Aug 2001 16:17:04 -0000 1.46
+++ readwrite.c 30 Dec 2001 14:30:58 -0000 1.47
@@ -77,7 +77,7 @@
ULONG blocksize;
ULONG size = *nbytes;
- apr_lock_acquire(thefile->mutex);
+ apr_thread_mutex_lock(thefile->mutex);
if (thefile->direction == 1) {
apr_file_flush(thefile);
@@ -111,7 +111,7 @@
}
*nbytes = rc == 0 ? pos - (char *)buf : 0;
- apr_lock_release(thefile->mutex);
+ apr_thread_mutex_unlock(thefile->mutex);
if (*nbytes == 0 && rc == 0) {
return APR_EOF;
@@ -164,7 +164,7 @@
int blocksize;
int size = *nbytes;
- apr_lock_acquire(thefile->mutex);
+ apr_thread_mutex_lock(thefile->mutex);
if ( thefile->direction == 0 ) {
// Position file pointer for writing at the offset we are logically reading from
@@ -186,7 +186,7 @@
size -= blocksize;
}
- apr_lock_release(thefile->mutex);
+ apr_thread_mutex_unlock(thefile->mutex);
return APR_OS2_STATUS(rc);
} else {
if (thefile->flags & APR_APPEND) {
1.29 +2 -2 apr/include/arch/os2/fileio.h
Index: fileio.h
===================================================================
RCS file: /home/cvs/apr/include/arch/os2/fileio.h,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- fileio.h 10 Oct 2001 14:19:00 -0000 1.28
+++ fileio.h 30 Dec 2001 14:30:58 -0000 1.29
@@ -57,7 +57,7 @@
#include "apr_private.h"
#include "apr_general.h"
-#include "apr_lock.h"
+#include "apr_thread_mutex.h"
#include "apr_file_io.h"
#include "apr_file_info.h"
#include "apr_errno.h"
@@ -89,7 +89,7 @@
unsigned long dataRead; // amount of valid data read into buffer
int direction; // buffer being used for 0 = read, 1 = write
unsigned long filePtr; // position in file of handle
- apr_lock_t *mutex; // mutex semaphore, must be owned to access the above fields
+ apr_thread_mutex_t *mutex;// mutex semaphore, must be owned to access the above fields
};
struct apr_dir_t {