--------------------- PatchSet 8693 Date: 2006/09/30 15:22:01 Author: serassio Branch: nt Tag: (none) Log: Fix coss crash during squid shutdown Members: src/fs/coss/store_io_coss.c:1.15.8.17->1.15.8.18 Index: squid/src/fs/coss/store_io_coss.c =================================================================== RCS file: /cvsroot/squid-sf//squid/src/fs/coss/store_io_coss.c,v retrieving revision 1.15.8.17 retrieving revision 1.15.8.18 diff -u -r1.15.8.17 -r1.15.8.18 --- squid/src/fs/coss/store_io_coss.c 23 Sep 2006 11:56:24 -0000 1.15.8.17 +++ squid/src/fs/coss/store_io_coss.c 30 Sep 2006 15:22:01 -0000 1.15.8.18 @@ -684,6 +684,8 @@ #ifdef _SQUID_MSWIN_ /* Allocate an overlapped structure. */ LPOVERLAPPED Overlapped = xcalloc(1, sizeof(OVERLAPPED)); + HANDLE hEvent = CreateEvent(NULL, TRUE, FALSE, NULL); + #endif /* First, flush pending IO ops */ @@ -711,18 +713,22 @@ Overlapped->Offset = t->diskstart; Overlapped->OffsetHigh = 0; #endif - Overlapped->hEvent = NULL; + Overlapped->hEvent = hEvent; WriteFile((HANDLE) _get_osfhandle(cs->fd), /* handle to file */ t->buffer, /* data buffer */ (size_t) (end - t->diskstart), /* number of bytes to write */ NULL, /* number of bytes written */ - Overlapped); /* overlapped buffer */ - xfree(Overlapped); + Overlapped); /* overlapped buffer */ + WaitForSingleObject(hEvent, INFINITE); #else lseek(cs->fd, t->diskstart, SEEK_SET); FD_WRITE_METHOD(cs->fd, t->buffer, end - t->diskstart); #endif } +#ifdef _SQUID_MSWIN_ + xfree(Overlapped); +#endif + } static void