Changeset 3477 for trunk/src/kash/shfile.c
- Timestamp:
- Sep 17, 2020, 11:52:16 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/shfile.c
r3473 r3477 33 33 #include <stdio.h> 34 34 #include <string.h> 35 #include <assert.h>36 35 37 36 #if K_OS == K_OS_WINDOWS … … 235 234 if (decrement_pending) 236 235 { 237 assert(g_shfile_async_close.num_pending > 0);236 kHlpAssert(g_shfile_async_close.num_pending > 0); 238 237 g_shfile_async_close.num_pending -= 1; 239 238 } … … 242 241 if (idx != g_shfile_async_close.idx_write % K_ELEMENTS(g_shfile_async_close.handles)) 243 242 { 244 assert(g_shfile_async_close.num_pending > 0);243 kHlpAssert(g_shfile_async_close.num_pending > 0); 245 244 toclose = g_shfile_async_close.handles[idx]; 246 assert(toclose);245 kHlpAssert(toclose); 247 246 g_shfile_async_close.handles[idx] = NULL; 248 247 g_shfile_async_close.idx_read = (idx + 1) % K_ELEMENTS(g_shfile_async_close.handles); … … 254 253 { 255 254 BOOL rc = SetEvent(g_shfile_async_close.evt_sync); 256 assert(rc);255 kHlpAssert(rc); 257 256 g_shfile_async_close.signal_sync = FALSE; 258 257 } … … 265 264 { 266 265 BOOL rc = CloseHandle(toclose); 267 assert(rc);266 kHlpAssert(rc); 268 267 decrement_pending = K_TRUE; 269 268 } … … 271 270 { 272 271 DWORD dwRet = WaitForSingleObject(g_shfile_async_close.evt_workers, 10000 /*ms*/); 273 assert(dwRet == WAIT_OBJECT_0 || dwRet == WAIT_TIMEOUT);272 kHlpAssert(dwRet == WAIT_OBJECT_0 || dwRet == WAIT_TIMEOUT); 274 273 decrement_pending = K_FALSE; 275 274 } … … 303 302 { 304 303 /* Write the handle to the ring buffer: */ 305 assert(g_shfile_async_close.handles[idx] == NULL);304 kHlpAssert(g_shfile_async_close.handles[idx] == NULL); 306 305 g_shfile_async_close.handles[idx] = toclose; 307 306 g_shfile_async_close.idx_write = idx_next; … … 311 310 312 311 ret = SetEvent(g_shfile_async_close.evt_workers); 313 assert(ret);312 kHlpAssert(ret); 314 313 if (ret) 315 314 { … … 322 321 intptr_t hThread = _beginthreadex(NULL /*security*/, 0 /*stack_size*/, shfile_async_close_handle_thread, 323 322 NULL /*arg*/, 0 /*initflags*/, &tid); 324 assert(hThread != -1);323 kHlpAssert(hThread != -1); 325 324 if (hThread != -1) 326 325 { … … 375 374 { 376 375 BOOL rc = ResetEvent(g_shfile_async_close.evt_sync); 377 assert(rc); K_NOREF(rc);376 kHlpAssert(rc); K_NOREF(rc); 378 377 379 378 g_shfile_async_close.signal_sync = K_TRUE; … … 384 383 TRACE2((NULL, "shfile_async_close_sync: Calling WaitForSingleObject...\n")); 385 384 dwRet = WaitForSingleObject(g_shfile_async_close.evt_sync, 10000 /*ms*/); 386 assert(dwRet == WAIT_OBJECT_0);387 assert(g_shfile_async_close.num_pending == 0);385 kHlpAssert(dwRet == WAIT_OBJECT_0); 386 kHlpAssert(g_shfile_async_close.num_pending == 0); 388 387 TRACE2((NULL, "shfile_async_close_sync: WaitForSingleObject returned %u...\n", dwRet)); 389 388 } … … 441 440 KU64 ns = shfile_nano_ts(); 442 441 BOOL fRc = CloseHandle((HANDLE)native); 443 assert(fRc); K_NOREF(fRc);442 kHlpAssert(fRc); K_NOREF(fRc); 444 443 ns = shfile_nano_ts() - ns; 445 444 if (ns > 1000000) … … 448 447 # else 449 448 BOOL fRc = CloseHandle((HANDLE)native); 450 assert(fRc); K_NOREF(fRc);449 kHlpAssert(fRc); K_NOREF(fRc); 451 450 # endif 452 451 } … … 656 655 { 657 656 shmtx_leave(&pfdtab->mtx, ptmp); 658 assert(file);657 kHlpAssert(file); 659 658 (void)file; 660 659 } … … 1069 1068 1070 1069 fd2 = shfile_insert(pfdtab, (intptr_t)h, fFlags, fFlags2, i, "shtab_init", NULL); 1071 assert(fd2 == i); (void)fd2;1070 kHlpAssert(fd2 == i); (void)fd2; 1072 1071 if (fd2 != i) 1073 1072 rc = -1; … … 1095 1094 fFlags2 = SHFILE_FLAGS_FILE; 1096 1095 fd2 = shfile_insert(pfdtab, (intptr_t)hFile, fFlags, fFlags2, i, "shtab_init", NULL); 1097 assert(fd2 == i); (void)fd2;1096 kHlpAssert(fd2 == i); (void)fd2; 1098 1097 if (fd2 != i) 1099 1098 rc = -1; … … 1136 1135 native = fd; 1137 1136 fd2 = shfile_insert(pfdtab, native, oflags, fFlags2, fd, "shtab_init", NULL); 1138 assert(fd2 == fd); (void)fd2;1137 kHlpAssert(fd2 == fd); (void)fd2; 1139 1138 if (fd2 != fd) 1140 1139 rc = -1; … … 1268 1267 #if K_OS == K_OS_WINDOWS 1269 1268 BOOL rc = CloseHandle((HANDLE)pfd->native); 1270 assert(rc == TRUE); K_NOREF(rc);1269 kHlpAssert(rc == TRUE); K_NOREF(rc); 1271 1270 #else 1272 1271 int rc = close((int)pfd->native); 1273 assert(rc == 0); K_NOREF(rc);1272 kHlpAssert(rc == 0); K_NOREF(rc); 1274 1273 #endif 1275 1274 pfd->fd = -1; … … 1330 1329 TRACE2((NULL, "shfile_set_inherit_win: %p -> %p (set=%d)\n", pfd->native, hFile, set)); 1331 1330 if (!CloseHandle((HANDLE)pfd->native)) 1332 assert(0);1331 kHlpAssert(0); 1333 1332 pfd->native = (intptr_t)hFile; 1334 1333 } … … 1336 1335 { 1337 1336 err = GetLastError(); 1338 assert(0);1337 kHlpAssert(0); 1339 1338 hFile = (HANDLE)pfd->native; 1340 1339 } … … 2043 2042 { 2044 2043 # if K_OS == K_OS_WINDOWS 2045 assert(SEEK_SET == FILE_BEGIN);2046 assert(SEEK_CUR == FILE_CURRENT);2047 assert(SEEK_END == FILE_END);2044 kHlpAssert(SEEK_SET == FILE_BEGIN); 2045 kHlpAssert(SEEK_CUR == FILE_CURRENT); 2046 kHlpAssert(SEEK_END == FILE_END); 2048 2047 rc = SetFilePointer((HANDLE)file->native, off, NULL, whench); 2049 2048 if (rc == INVALID_SET_FILE_POINTER) … … 2096 2095 { 2097 2096 # if K_OS == K_OS_WINDOWS 2098 assert(0);2097 kHlpAssert(0); 2099 2098 errno = EINVAL; 2100 2099 rc = -1;
Note:
See TracChangeset
for help on using the changeset viewer.