Changeset 86
- Timestamp:
- Jul 15, 2001, 10:57:25 AM (24 years ago)
- Location:
- trunk
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/threads.h
r70 r86 13 13 14 14 /* 15 * Copyright (C) 1997-200 0Ulrich Mller.15 * Copyright (C) 1997-2001 Ulrich Mller. 16 16 * This file is part of the "XWorkplace helpers" source package. 17 17 * This is free software; you can redistribute it and/or modify … … 40 40 *@@ THREADINFO: 41 41 * thread info structure passed to secondary threads. 42 * See thrCreate. 42 43 */ 43 44 44 45 typedef struct _THREADINFO 45 46 { 46 47 48 49 50 51 52 47 // data maintained by thr* functions 48 ULONG cbStruct; 49 void* pThreadFunc; // as passed to thrCreate, really a PTHREADFUNC 50 PULONG ptidRunning; // as passed to thrCreate V0.9.12 (2001-05-20) [umoeller] 51 const char *pcszThreadName; // as passed to thrCreate 52 ULONG flFlags; // as passed to thrCreate 53 ULONG ulData; // as passed to thrCreate 53 54 54 55 55 TID tid; 56 ULONG hevRunning; // this is a HEV really 56 57 57 58 59 60 58 // data maintained by thr_fntGeneric 59 HAB hab; // for PM threads 60 HMQ hmq; // for PM threads 61 BOOL fExitComplete; 61 62 62 63 64 65 66 63 // data to be maintained by application 64 BOOL fExit; 65 ULONG ulResult; 66 ULONG ulFuncInfo; 67 HWND hwndNotify; 67 68 } THREADINFO, *PTHREADINFO; 68 69 … … 70 71 typedef THREADFUNC *PTHREADFUNC; 71 72 72 ULONG thrCreate(PTHREADINFO pti, 73 PTHREADFUNC pfn, 74 PBOOL pfRunning, 75 const char *pcszThreadName, 76 ULONG flFlags, 77 ULONG ulData); 73 ULONG XWPENTRY thrCreate(PTHREADINFO pti, 74 PTHREADFUNC pfn, 75 PULONG pfRunning, 76 const char *pcszThreadName, 77 ULONG flFlags, 78 ULONG ulData); 79 // this function is exported, so add definition here V0.9.13 (2001-06-13) [lafaix] 80 typedef BOOL XWPENTRY THRCREATE(PTHREADINFO, PTHREADFUNC, PULONG, const char *, ULONG, ULONG); 81 typedef THRCREATE *PTHRCREATE; 78 82 79 ULONG thrRunSync(HAB hab,80 PTHREADFUNC pfn,81 const char *pcszThreadName,82 ULONG ulData);83 ULONG XWPENTRY thrRunSync(HAB hab, 84 PTHREADFUNC pfn, 85 const char *pcszThreadName, 86 ULONG ulData); 83 87 84 PTHREADINFO thrListThreads(PULONG pcThreads);88 PTHREADINFO XWPENTRY thrListThreads(PULONG pcThreads); 85 89 86 BOOL thrFindThread(PTHREADINFO pti,87 ULONG tid);90 BOOL XWPENTRY thrFindThread(PTHREADINFO pti, 91 ULONG tid); 88 92 89 BOOL thrClose(PTHREADINFO pti);93 BOOL XWPENTRY thrClose(PTHREADINFO pti); 90 94 91 BOOL thrWait(PTHREADINFO pti);95 BOOL XWPENTRY thrWait(PTHREADINFO pti); 92 96 93 BOOL thrFree(PTHREADINFO pti);97 BOOL XWPENTRY thrFree(PTHREADINFO pti); 94 98 95 BOOL thrKill(PTHREADINFO pti);99 BOOL XWPENTRY thrKill(PTHREADINFO pti); 96 100 97 TID thrQueryID(const THREADINFO* pti);101 TID XWPENTRY thrQueryID(const THREADINFO* pti); 98 102 99 ULONG thrQueryPriority(VOID);103 ULONG XWPENTRY thrQueryPriority(VOID); 100 104 101 105 #endif -
trunk/src/helpers/dialog.c
r85 r86 1180 1180 + } 1181 1181 * 1182 * 1182 *@@changed V0.9.14 (2001-07-07) [umoeller]: fixed disabled mouse with hwndOwner == HWND_DESKTOP 1183 1183 */ 1184 1184 … … 1381 1381 // add "clip siblings" style 1382 1382 flStyle |= WS_CLIPSIBLINGS; 1383 1384 if (hwndOwner == HWND_DESKTOP) 1385 // there's some dumb XWorkplace code left 1386 // which uses this, and this disables the 1387 // mouse for some reason 1388 // V0.9.14 (2001-07-07) [umoeller] 1389 hwndOwner = NULLHANDLE; 1383 1390 1384 1391 pDlgData->hwndDlg = WinCreateWindow(HWND_DESKTOP, -
trunk/src/helpers/dosh.c
r82 r86 2270 2270 else 2271 2271 { 2272 // **patrick, this was missing... 2273 // wonder if you ever tested this, this crashes in 2274 // doshPerfGet otherwise ;-) 2275 /* -----------> */ pPerfSys->palIntrs = (PLONG)malloc(pPerfSys->cProcessors * sizeof(LONG)); 2272 pPerfSys->palIntrs = (PLONG)malloc(pPerfSys->cProcessors * sizeof(LONG)); 2276 2273 if (!pPerfSys->palIntrs) 2277 2274 arc = ERROR_NOT_ENOUGH_MEMORY; … … 2284 2281 pPerfSys->padIntrPrev[ul] = 0.0; 2285 2282 pPerfSys->palLoads[ul] = 0; 2286 /* and this one too */pPerfSys->palIntrs[ul] = 0;2283 pPerfSys->palIntrs[ul] = 0; 2287 2284 } 2288 2285 } -
trunk/src/helpers/helpers_pre.in
r76 r86 42 42 $(OUTPUTDIR)\encodings.obj \ 43 43 $(OUTPUTDIR)\linklist.obj \ 44 $(OUTPUTDIR)\math.obj \ 44 45 $(OUTPUTDIR)\tree.obj \ 45 46 $(OUTPUTDIR)\xml.obj \ -
trunk/src/helpers/linklist.c
r74 r86 263 263 } 264 264 265 #e ndif// __DEBUG_MALLOC_ENABLED__265 #else // __DEBUG_MALLOC_ENABLED__ 266 266 267 267 /* … … 286 286 */ 287 287 288 PLINKLIST (lstCreate)(BOOL fItemsFreeable) // in: invoke free() on the data288 PLINKLIST lstCreate(BOOL fItemsFreeable) // in: invoke free() on the data 289 289 // item pointers upon destruction? 290 290 { … … 294 294 return (pNewList); 295 295 } 296 297 #endif // __DEBUG_MALLOC_ENABLED__ 296 298 297 299 /* … … 614 616 } 615 617 616 #e ndif// __DEBUG_MALLOC_ENABLED__618 #else // __DEBUG_MALLOC_ENABLED__ 617 619 618 620 /* … … 626 628 */ 627 629 628 PLISTNODE (lstAppendItem)(PLINKLIST pList,630 PLISTNODE lstAppendItem(PLINKLIST pList, 629 631 void* pNewItemData) // in: data to store in list node 630 632 { … … 668 670 } 669 671 672 #endif // __DEBUG_MALLOC_ENABLED__ 673 670 674 /* 671 675 *@@ lstInsertItemBefore: … … 688 692 * This returns the LISTNODE of the new list item, 689 693 * or NULL upon errors. 694 * 695 *@@changed V0.9.14 (2001-07-14) [umoeller]: this never worked on empty lists, fixed 690 696 */ 691 697 … … 716 722 pList->pFirst = pNewNode; 717 723 718 pList->ulCount++; 724 if (!pList->pLast) 725 // the list was empty: 726 pList->pLast = pNewNode; // V0.9.14 (2001-07-14) [umoeller] 727 728 (pList->ulCount)++; 719 729 } 720 730 else … … 744 754 pList->pLast = pNewNode; 745 755 746 pList->ulCount++;756 (pList->ulCount)++; 747 757 } 748 758 else -
trunk/src/helpers/timer.c
r74 r86 71 71 72 72 /* 73 * Copyright (C) 2000 Ulrich Mller.73 * Copyright (C) 2000-2001 Ulrich Mller. 74 74 * This file is part of the "XWorkplace helpers" source package. 75 75 * This is free software; you can redistribute it and/or modify … … 109 109 #include "helpers\except.h" 110 110 #include "helpers\linklist.h" 111 #include "helpers\math.h" 111 112 #include "helpers\threads.h" 112 113 #include "helpers\timer.h" … … 241 242 * 242 243 *@@added V0.9.9 (2001-03-07) [umoeller] 244 *@@changed V0.9.14 (2001-07-07) [umoeller]: added GCD optimizations 243 245 */ 244 246 … … 265 267 { 266 268 // we have timers: 269 267 270 ULONG ulOldPMTimeout = pSet->ulPMTimeout; 268 pSet->ulPMTimeout = 1000; 269 270 while (pNode) 271 { 271 272 if (!pNode->pNext) 273 { 274 // only one timer: 275 // that's easy 272 276 PXTIMER pTimer = (PXTIMER)pNode->pItemData; 273 274 if ( (pTimer->ulTimeout / 2) < pSet->ulPMTimeout ) 275 pSet->ulPMTimeout = pTimer->ulTimeout / 2; 276 277 pNode = pNode->pNext; 277 pSet->ulPMTimeout = pTimer->ulTimeout; 278 } 279 else if (!pNode->pNext->pNext) 280 { 281 // exactly two timers: 282 // find the greatest common denominator 283 PXTIMER pTimer1 = (PXTIMER)pNode->pItemData, 284 pTimer2 = (PXTIMER)pNode->pNext->pItemData; 285 286 pSet->ulPMTimeout = mathGCD(pTimer1->ulTimeout, 287 pTimer2->ulTimeout); 288 } 289 else 290 { 291 // several timers: 292 // run through all timers and find the greatest 293 // common denominator of all frequencies... 294 295 ULONG cTimers = lstCountItems(pllXTimers); 296 int *paInts = (int*)_alloca(sizeof(int) * cTimers), 297 i = 0; 298 299 _Pmpf(("Recalculating, got %d timers %d", cTimers)); 300 301 // fill an array of integers with the 302 // timer frequencies 303 while (pNode) 304 { 305 PXTIMER pTimer = (PXTIMER)pNode->pItemData; 306 307 _Pmpf((" timeout %d is %d", i, pTimer->ulTimeout)); 308 309 paInts[i++] = pTimer->ulTimeout; 310 311 pNode = pNode->pNext; 312 } 313 314 pSet->ulPMTimeout = mathGCDMulti(paInts, 315 cTimers); 316 _Pmpf(("--> GCD is %d", pSet->ulPMTimeout)); 278 317 } 279 318 … … 518 557 * when the window is destroyed. 519 558 * 559 * Note: Unless you own the timer set that 560 * your timer runs on, it is strongly recommended 561 * that your timer frequency is set to a multiple 562 * of 125. The PM master timer behind the timer 563 * set will be set to the greatest common divisor 564 * of all frequencies, and if you set one timer 565 * to 2000 and the other one to 2001, you will 566 * cause quite a lot of overhead. This applies 567 * especially to timers started by XCenter widgets. 568 * 569 * For security, all timer frequencies will be 570 * rounded to multiples of 25 anyway. Still, 571 * running two timers at 1000 and 1025 will cause 572 * the master timer to be set to 25, which is 573 * overkill. 574 * 520 575 *@@changed V0.9.7 (2000-12-08) [umoeller]: got rid of dtGetULongTime 521 576 *@@changed V0.9.12 (2001-05-12) [umoeller]: added mutex protection 577 *@@changed V0.9.14 (2001-07-12) [umoeller]: now rounding freq's to multiples of 25 522 578 */ 523 579 … … 540 596 { 541 597 PXTIMER pTimer; 598 599 // fix the timeout... we allow only multiples of 600 // 20, and it must be at least 20 (otherwise our 601 // internal master timer calculations will fail) 602 // V0.9.14 (2001-07-07) [umoeller] 603 if (ulTimeout < 25) 604 ulTimeout = 25; 605 else 606 ulTimeout = (ulTimeout + 10) / 25 * 25; 542 607 543 608 // check if this timer exists already -
trunk/src/helpers/tree.c
r85 r86 883 883 *@@ treeFind: 884 884 * finds the tree node with the specified key. 885 * Returns NULL if none exists. 885 886 */ 886 887 -
trunk/src/helpers/xstring.c
r74 r86 705 705 * "cReplaceWithLen" characters from pcszReplaceWith. 706 706 * 707 * If cReplaceWithLen is 0, characters are removed only. 708 * 707 709 * Returns the new length of the string, excluding 708 710 * the null terminator, or 0 if the replacement failed … … 739 741 *@@changed V0.9.9 (2001-03-09) [umoeller]: now using xstrReserve 740 742 *@@changed V0.9.11 (2001-04-22) [umoeller]: replaced replacement XSTRING with PCSZ 743 *@@changed V0.9.14 (2001-07-07) [umoeller]: this did nothing if cReplaceWithLen == 0, fixed 741 744 */ 742 745 … … 753 756 if ( (pxstr) // V0.9.9 (2001-02-14) [umoeller] 754 757 && (ulFirstReplOfs + cReplLen <= pxstr->ulLength) 755 && (pcszReplaceWith) 758 && ( (pcszReplaceWith) 759 || (cReplaceWithLen == 0) // fixed V0.9.14 (2001-07-07) [umoeller] 760 ) 756 761 ) 757 762 {
Note:
See TracChangeset
for help on using the changeset viewer.