------------------------------------------------------------ revno: 12619 revision-id: squid3@treenet.co.nz-20130911010002-1jtcwxoubv6zzsc3 parent: squid3@treenet.co.nz-20130911005853-v5hvdzkv8e02oepa committer: Amos Jeffries branch nick: 3.3 timestamp: Tue 2013-09-10 19:00:02 -0600 message: Windows: fix collision between POSIX wrappers and DiskIO class methods The POSIX function shutdown() is #define'd on Windows. This causes compiler issues with the DiskIO method of same name. Rename the method to gracefulShutdown() instead. Also, Bug 3189 was incomplete and missed a change to DiskThreads Windows initialization method. This is an iCelero project. ------------------------------------------------------------ # Bazaar merge directive format 2 (Bazaar 0.90) # revision_id: squid3@treenet.co.nz-20130911010002-1jtcwxoubv6zzsc3 # target_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # testament_sha1: 901540010f5b876f85e92e2e0779f3eb99396ca6 # timestamp: 2013-09-11 01:08:43 +0000 # source_branch: http://bzr.squid-cache.org/bzr/squid3/3.3 # base_revision_id: squid3@treenet.co.nz-20130911005853-\ # v5hvdzkv8e02oepa # # Begin patch === modified file 'src/DiskIO/AIO/AIODiskIOModule.cc' --- src/DiskIO/AIO/AIODiskIOModule.cc 2012-09-01 14:38:36 +0000 +++ src/DiskIO/AIO/AIODiskIOModule.cc 2013-09-11 01:00:02 +0000 @@ -50,7 +50,7 @@ {} void -AIODiskIOModule::shutdown() +AIODiskIOModule::gracefulShutdown() {} DiskIOStrategy * === modified file 'src/DiskIO/AIO/AIODiskIOModule.h' --- src/DiskIO/AIO/AIODiskIOModule.h 2012-09-01 14:38:36 +0000 +++ src/DiskIO/AIO/AIODiskIOModule.h 2013-09-11 01:00:02 +0000 @@ -42,7 +42,7 @@ static AIODiskIOModule &GetInstance(); AIODiskIOModule(); virtual void init(); - virtual void shutdown(); + virtual void gracefulShutdown(); virtual char const *type () const; virtual DiskIOStrategy* createStrategy(); === modified file 'src/DiskIO/AIO/aio_win32.cc' --- src/DiskIO/AIO/aio_win32.cc 2012-09-01 14:38:36 +0000 +++ src/DiskIO/AIO/aio_win32.cc 2013-09-11 01:00:02 +0000 @@ -32,8 +32,11 @@ */ #include "squid.h" +#include "DiskIO/AIO/aio_win32.h" #include "comm.h" -#include "aio_win32.h" +#include "fd.h" +#include "StatCounters.h" +#include "win32.h" #if HAVE_ERRNO_H #include === modified file 'src/DiskIO/Blocking/BlockingDiskIOModule.cc' --- src/DiskIO/Blocking/BlockingDiskIOModule.cc 2012-09-01 14:38:36 +0000 +++ src/DiskIO/Blocking/BlockingDiskIOModule.cc 2013-09-11 01:00:02 +0000 @@ -49,7 +49,7 @@ {} void -BlockingDiskIOModule::shutdown() +BlockingDiskIOModule::gracefulShutdown() {} DiskIOStrategy* === modified file 'src/DiskIO/Blocking/BlockingDiskIOModule.h' --- src/DiskIO/Blocking/BlockingDiskIOModule.h 2012-09-01 14:38:36 +0000 +++ src/DiskIO/Blocking/BlockingDiskIOModule.h 2013-09-11 01:00:02 +0000 @@ -41,7 +41,7 @@ static BlockingDiskIOModule &GetInstance(); BlockingDiskIOModule(); virtual void init(); - virtual void shutdown(); + virtual void gracefulShutdown(); virtual char const *type () const; virtual DiskIOStrategy* createStrategy(); === modified file 'src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc' --- src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc 2012-09-01 14:38:36 +0000 +++ src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.cc 2013-09-11 01:00:02 +0000 @@ -79,7 +79,7 @@ } void -DiskDaemonDiskIOModule::shutdown() +DiskDaemonDiskIOModule::gracefulShutdown() { initialised = false; } === modified file 'src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.h' --- src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.h 2012-09-01 14:38:36 +0000 +++ src/DiskIO/DiskDaemon/DiskDaemonDiskIOModule.h 2013-09-11 01:00:02 +0000 @@ -41,7 +41,7 @@ static DiskDaemonDiskIOModule &GetInstance(); DiskDaemonDiskIOModule(); virtual void init(); - virtual void shutdown(); + virtual void gracefulShutdown(); virtual char const *type () const; virtual DiskIOStrategy* createStrategy(); === modified file 'src/DiskIO/DiskIOModule.cc' --- src/DiskIO/DiskIOModule.cc 2012-08-14 11:53:07 +0000 +++ src/DiskIO/DiskIOModule.cc 2013-09-11 01:00:02 +0000 @@ -95,7 +95,7 @@ while (GetModules().size()) { DiskIOModule *fs = GetModules().back(); GetModules().pop_back(); - fs->shutdown(); + fs->gracefulShutdown(); } } === modified file 'src/DiskIO/DiskIOModule.h' --- src/DiskIO/DiskIOModule.h 2012-09-01 14:38:36 +0000 +++ src/DiskIO/DiskIOModule.h 2013-09-11 01:00:02 +0000 @@ -65,7 +65,7 @@ virtual void init() = 0; //virtual void registerWithCacheManager(void); - virtual void shutdown() = 0; + virtual void gracefulShutdown() = 0; virtual DiskIOStrategy *createStrategy() = 0; virtual char const *type () const = 0; === modified file 'src/DiskIO/DiskThreads/CommIO.cc' --- src/DiskIO/DiskThreads/CommIO.cc 2012-11-10 04:02:52 +0000 +++ src/DiskIO/DiskThreads/CommIO.cc 2013-09-11 01:00:02 +0000 @@ -37,6 +37,7 @@ #include "DiskIO/DiskThreads/CommIO.h" #include "fd.h" #include "globals.h" +#include "win32.h" void CommIO::Initialize() === modified file 'src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.cc' --- src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.cc 2012-09-01 14:38:36 +0000 +++ src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.cc 2013-09-11 01:00:02 +0000 @@ -52,7 +52,7 @@ } void -DiskThreadsDiskIOModule::shutdown() +DiskThreadsDiskIOModule::gracefulShutdown() { DiskThreadsIOStrategy::Instance.done(); } === modified file 'src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.h' --- src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.h 2012-09-01 14:38:36 +0000 +++ src/DiskIO/DiskThreads/DiskThreadsDiskIOModule.h 2013-09-11 01:00:02 +0000 @@ -42,7 +42,7 @@ DiskThreadsDiskIOModule(); virtual void init(); //virtual void registerWithCacheManager(void); - virtual void shutdown(); + virtual void gracefulShutdown(); virtual char const *type () const; virtual DiskIOStrategy* createStrategy(); === modified file 'src/DiskIO/DiskThreads/aiops_win32.cc' --- src/DiskIO/DiskThreads/aiops_win32.cc 2012-09-04 09:10:20 +0000 +++ src/DiskIO/DiskThreads/aiops_win32.cc 2013-09-11 01:00:02 +0000 @@ -36,6 +36,7 @@ #include "squid_windows.h" #include "DiskIO/DiskThreads/CommIO.h" #include "DiskThreads.h" +#include "fd.h" #include "SquidConfig.h" #include "SquidTime.h" #include "Store.h" @@ -210,7 +211,7 @@ MemAllocator *pool; if ((pool = squidaio_get_pool(size)) != NULL) { - pool->free(p); + pool->freeOne(p); } else xfree(p); } @@ -222,7 +223,7 @@ int len = strlen(str) + 1; if ((pool = squidaio_get_pool(len)) != NULL) { - pool->free(str); + pool->freeOne(str); } else xfree(str); } @@ -296,7 +297,9 @@ done_queue.blocked = 0; - CommIO::NotifyIOCompleted(); + // Initialize the thread I/O pipes before creating any threads + // see bug 3189 comment 5 about race conditions. + CommIO::Initialize(); /* Create threads and get them to sit in their wait loop */ squidaio_thread_pool = memPoolCreate("aio_thread", sizeof(squidaio_thread_t)); @@ -716,7 +719,7 @@ resultp->aio_errno = requestp->err; } - squidaio_request_pool->free(requestp); + squidaio_request_pool->freeOne(requestp); } /* squidaio_cleanup_request */ int === modified file 'src/DiskIO/IpcIo/IpcIoDiskIOModule.cc' --- src/DiskIO/IpcIo/IpcIoDiskIOModule.cc 2012-08-28 13:00:30 +0000 +++ src/DiskIO/IpcIo/IpcIoDiskIOModule.cc 2013-09-11 01:00:02 +0000 @@ -18,7 +18,7 @@ {} void -IpcIoDiskIOModule::shutdown() +IpcIoDiskIOModule::gracefulShutdown() {} DiskIOStrategy* === modified file 'src/DiskIO/IpcIo/IpcIoDiskIOModule.h' --- src/DiskIO/IpcIo/IpcIoDiskIOModule.h 2011-02-01 05:01:43 +0000 +++ src/DiskIO/IpcIo/IpcIoDiskIOModule.h 2013-09-11 01:00:02 +0000 @@ -10,7 +10,7 @@ static IpcIoDiskIOModule &GetInstance(); IpcIoDiskIOModule(); virtual void init(); - virtual void shutdown(); + virtual void gracefulShutdown(); virtual char const *type () const; virtual DiskIOStrategy* createStrategy(); === modified file 'src/DiskIO/Mmapped/MmappedDiskIOModule.cc' --- src/DiskIO/Mmapped/MmappedDiskIOModule.cc 2012-08-28 13:00:30 +0000 +++ src/DiskIO/Mmapped/MmappedDiskIOModule.cc 2013-09-11 01:00:02 +0000 @@ -18,7 +18,7 @@ {} void -MmappedDiskIOModule::shutdown() +MmappedDiskIOModule::gracefulShutdown() {} DiskIOStrategy* === modified file 'src/DiskIO/Mmapped/MmappedDiskIOModule.h' --- src/DiskIO/Mmapped/MmappedDiskIOModule.h 2011-01-27 21:14:56 +0000 +++ src/DiskIO/Mmapped/MmappedDiskIOModule.h 2013-09-11 01:00:02 +0000 @@ -10,7 +10,7 @@ static MmappedDiskIOModule &GetInstance(); MmappedDiskIOModule(); virtual void init(); - virtual void shutdown(); + virtual void gracefulShutdown(); virtual char const *type () const; virtual DiskIOStrategy* createStrategy();