From: <ale...@us...> - 2010-07-16 07:22:50
|
Revision: 51344 http://firebird.svn.sourceforge.net/firebird/?rev=51344&view=rev Author: alexpeshkoff Date: 2010-07-16 07:22:44 +0000 (Fri, 16 Jul 2010) Log Message: ----------- moved tag Modified Paths: -------------- firebird/tags/T2_5_0_RC3/src/common/classes/semaphore.h firebird/tags/T2_5_0_RC3/src/jrd/DatabaseSnapshot.cpp firebird/tags/T2_5_0_RC3/src/jrd/event.cpp firebird/tags/T2_5_0_RC3/src/jrd/isc_s_proto.h firebird/tags/T2_5_0_RC3/src/jrd/isc_sync.cpp firebird/tags/T2_5_0_RC3/src/lock/lock.cpp firebird/tags/T2_5_0_RC3/src/lock/print.cpp Modified: firebird/tags/T2_5_0_RC3/src/common/classes/semaphore.h =================================================================== --- firebird/tags/T2_5_0_RC3/src/common/classes/semaphore.h 2010-07-16 07:20:55 UTC (rev 51343) +++ firebird/tags/T2_5_0_RC3/src/common/classes/semaphore.h 2010-07-16 07:22:44 UTC (rev 51344) @@ -115,7 +115,7 @@ void enter() { - dispatch_semaphore_wait(semaphore); + dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); } void release(SLONG count = 1) Modified: firebird/tags/T2_5_0_RC3/src/jrd/DatabaseSnapshot.cpp =================================================================== --- firebird/tags/T2_5_0_RC3/src/jrd/DatabaseSnapshot.cpp 2010-07-16 07:20:55 UTC (rev 51343) +++ firebird/tags/T2_5_0_RC3/src/jrd/DatabaseSnapshot.cpp 2010-07-16 07:22:44 UTC (rev 51344) @@ -120,7 +120,7 @@ { #if (defined HAVE_MMAP || defined WIN_NT) ISC_STATUS_ARRAY statusVector; - base = (Header*) ISC_remap_file(statusVector, &handle, base->allocated, false); + base = (Header*) ISC_remap_file(statusVector, &handle, base->allocated, false, &mutex); if (!base) { status_exception::raise(statusVector); @@ -268,7 +268,7 @@ #if (defined HAVE_MMAP || defined WIN_NT) ISC_STATUS_ARRAY statusVector; - base = (Header*) ISC_remap_file(statusVector, &handle, newSize, true); + base = (Header*) ISC_remap_file(statusVector, &handle, newSize, true, &mutex); if (!base) { status_exception::raise(statusVector); Modified: firebird/tags/T2_5_0_RC3/src/jrd/event.cpp =================================================================== --- firebird/tags/T2_5_0_RC3/src/jrd/event.cpp 2010-07-16 07:20:55 UTC (rev 51343) +++ firebird/tags/T2_5_0_RC3/src/jrd/event.cpp 2010-07-16 07:22:44 UTC (rev 51344) @@ -60,8 +60,10 @@ #include <process.h> #include <windows.h> #define MUTEX &m_mutex +#define MUTEX_PTR NULL #else #define MUTEX m_mutex +#define MUTEX_PTR &m_mutex #endif #define SRQ_BASE ((UCHAR*) m_header) @@ -566,7 +568,7 @@ #if (defined HAVE_MMAP || defined WIN_NT) ISC_STATUS_ARRAY local_status; - header = (evh*) ISC_remap_file(local_status, &m_shmemData, length, false); + header = (evh*) ISC_remap_file(local_status, &m_shmemData, length, false, MUTEX_PTR); #endif if (!header) { @@ -620,7 +622,7 @@ #if (defined HAVE_MMAP || defined WIN_NT) ISC_STATUS_ARRAY local_status; - header = (evh*) ISC_remap_file(local_status, &m_shmemData, ev_length, true); + header = (evh*) ISC_remap_file(local_status, &m_shmemData, ev_length, true, MUTEX_PTR); #endif if (header) { @@ -1119,7 +1121,7 @@ if (!initialize) { #ifndef WIN_NT - if ( (mutex_state = ISC_map_mutex(shmem_data, &m_header->evh_mutex, &MUTEX)) ) + if ( (mutex_state = ISC_map_mutex(shmem_data, &m_header->evh_mutex, MUTEX_PTR)) ) mutex_bugcheck("mutex map", mutex_state); #endif return; @@ -1133,7 +1135,7 @@ SRQ_INIT(m_header->evh_events); #ifndef WIN_NT - if ( (mutex_state = ISC_mutex_init(shmem_data, &m_header->evh_mutex, &MUTEX)) ) + if ( (mutex_state = ISC_mutex_init(shmem_data, &m_header->evh_mutex, MUTEX_PTR)) ) mutex_bugcheck("mutex init", mutex_state); #endif Modified: firebird/tags/T2_5_0_RC3/src/jrd/isc_s_proto.h =================================================================== --- firebird/tags/T2_5_0_RC3/src/jrd/isc_s_proto.h 2010-07-16 07:20:55 UTC (rev 51343) +++ firebird/tags/T2_5_0_RC3/src/jrd/isc_s_proto.h 2010-07-16 07:22:44 UTC (rev 51344) @@ -71,7 +71,7 @@ ULONG ISC_exception_post(ULONG, const TEXT*); #endif -UCHAR* ISC_remap_file(ISC_STATUS*, struct sh_mem*, ULONG, bool); +UCHAR* ISC_remap_file(ISC_STATUS*, struct sh_mem*, ULONG, bool, struct mtx**); void ISC_unmap_file(ISC_STATUS*, struct sh_mem*); void ISC_remove_map_file(const TEXT* filename); Modified: firebird/tags/T2_5_0_RC3/src/jrd/isc_sync.cpp =================================================================== --- firebird/tags/T2_5_0_RC3/src/jrd/isc_sync.cpp 2010-07-16 07:20:55 UTC (rev 51343) +++ firebird/tags/T2_5_0_RC3/src/jrd/isc_sync.cpp 2010-07-16 07:22:44 UTC (rev 51344) @@ -553,13 +553,22 @@ } } - static void remap(UCHAR* const from, UCHAR* to, int newLength) + static void remap(UCHAR* const from, UCHAR* to, int newLength, struct mtx** mtxPtr) { MutexLockGuard guard(mutex); for (unsigned int n = 0; n < sharedFiles.getCount(); ++n) { if (from == sharedFiles[n].from) { + if (mtxPtr) + { + UCHAR* m = (UCHAR*)(*mtxPtr); + if (m >= sharedFiles[n].from && m < sharedFiles[n].to) + { + m = to + (m - sharedFiles[n].from); + *mtxPtr = (struct mtx*)m; + } + } sharedFiles[n].from = to; sharedFiles[n].to = to + newLength; return; @@ -2415,7 +2424,7 @@ int ISC_map_mutex(sh_mem* shmem_data, mtx* mutex, mtx** mapped) { -#ifdef HAVE_MAP_OBJECT +#if defined(HAVE_MAP_OBJECT) && (!defined(USE_SYS5SEMAPHORE)) ISC_STATUS_ARRAY temp; mutex = reinterpret_cast<mtx*>(ISC_map_object(temp, shmem_data, reinterpret_cast<UCHAR*>(mutex) - shmem_data->sh_mem_address, sizeof(mtx))); @@ -2432,7 +2441,7 @@ void ISC_unmap_mutex(mtx* mutex) { -#ifdef HAVE_MAP_OBJECT +#if defined(HAVE_MAP_OBJECT) && (!defined(USE_SYS5SEMAPHORE)) ISC_STATUS_ARRAY temp; ISC_unmap_object(temp, reinterpret_cast<UCHAR**>(&mutex), sizeof(mtx)); if (mutex) @@ -3190,7 +3199,8 @@ UCHAR *ISC_remap_file(ISC_STATUS* status_vector, sh_mem* shmem_data, ULONG new_length, - bool flag) + bool flag, + struct mtx** mutex) { /************************************** * @@ -3210,11 +3220,12 @@ if ((U_IPTR) address == (U_IPTR) -1) return NULL; +#ifdef USE_SYS5SEMAPHORE + SharedFile::remap(shmem_data->sh_mem_address, address, new_length, mutex); +#endif + munmap((char *) shmem_data->sh_mem_address, shmem_data->sh_mem_length_mapped); -#ifdef USE_SYS5SEMAPHORE - SharedFile::remap(shmem_data->sh_mem_address, address, new_length); -#endif IPC_TRACE(("ISC_remap_file %p to %p %p\n", shmem_data->sh_mem_address, address, address + new_length)); shmem_data->sh_mem_address = address; @@ -3237,7 +3248,8 @@ UCHAR* ISC_remap_file(ISC_STATUS * status_vector, sh_mem* shmem_data, ULONG new_length, - bool flag) + bool flag, + struct mtx** /*mutex*/) { /************************************** * @@ -3340,7 +3352,8 @@ UCHAR* ISC_remap_file(ISC_STATUS * status_vector, sh_mem* shmem_data, ULONG new_length, - bool flag) + bool flag, + struct mtx** mutex) { /************************************** * Modified: firebird/tags/T2_5_0_RC3/src/lock/lock.cpp =================================================================== --- firebird/tags/T2_5_0_RC3/src/lock/lock.cpp 2010-07-16 07:20:55 UTC (rev 51343) +++ firebird/tags/T2_5_0_RC3/src/lock/lock.cpp 2010-07-16 07:22:44 UTC (rev 51344) @@ -96,8 +96,10 @@ #ifdef WIN_NT #include <process.h> #define MUTEX &m_shmemMutex +#define MUTEX_PTR NULL #else #define MUTEX m_lhb_mutex +#define MUTEX_PTR &m_lhb_mutex #endif #ifdef DEV_BUILD @@ -1162,7 +1164,8 @@ remap_local_owners(); // Remap the shared memory region ISC_STATUS_ARRAY status_vector; - lhb* const header = (lhb*) ISC_remap_file(status_vector, &m_shmem, new_length, false); + lhb* const header = (lhb*) ISC_remap_file(status_vector, &m_shmem, new_length, false, + MUTEX_PTR); if (header) m_header = header; else @@ -1264,7 +1267,7 @@ remap_local_owners(); // Remap the shared memory region const ULONG new_length = m_shmem.sh_mem_length_mapped + m_memorySize; - lhb* header = (lhb*) ISC_remap_file(status_vector, &m_shmem, new_length, true); + lhb* header = (lhb*) ISC_remap_file(status_vector, &m_shmem, new_length, true, MUTEX_PTR); if (header) { m_header = header; @@ -2338,7 +2341,7 @@ if (!initializeMemory) { #ifndef WIN_NT - if (ISC_map_mutex(shmem_data, &m_header->lhb_mutex, &(MUTEX))) { + if (ISC_map_mutex(shmem_data, &m_header->lhb_mutex, MUTEX_PTR)) { bug(NULL, "mutex map failed"); } #endif @@ -2360,7 +2363,7 @@ SRQ_INIT(m_header->lhb_free_requests); #ifndef WIN_NT - if (ISC_mutex_init(shmem_data, &m_header->lhb_mutex, &(MUTEX))) { + if (ISC_mutex_init(shmem_data, &m_header->lhb_mutex, MUTEX_PTR)) { bug(NULL, "mutex init failed"); } #endif Modified: firebird/tags/T2_5_0_RC3/src/lock/print.cpp =================================================================== --- firebird/tags/T2_5_0_RC3/src/lock/print.cpp 2010-07-16 07:20:55 UTC (rev 51343) +++ firebird/tags/T2_5_0_RC3/src/lock/print.cpp 2010-07-16 07:22:44 UTC (rev 51344) @@ -523,7 +523,7 @@ if (LOCK_header->lhb_length > shmem_data.sh_mem_length_mapped) { const ULONG length = LOCK_header->lhb_length; - LOCK_header = (lhb*) ISC_remap_file(status_vector, &shmem_data, length, false); + LOCK_header = (lhb*) ISC_remap_file(status_vector, &shmem_data, length, false, NULL); } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |