FUNCTION getItemFreezeResistant(VAR lAllItemList[], lWID, lItemTypeConstants, lItemsNum=-1, lTimeoutSeconds=30, lListViewColumnsNum=1, lFlgRejectDisableItems=FALSE)
RESULT = FALSE; lHND = IDTOHND(lWID); lCurSeconds = GETTIME()
IF !isExistProcess(lHND) THEN EXIT
FOR lJ=0 TO lTimeoutSeconds
FOR lI=0 TO 5
IF staticSemaphoreGetItemByThread_inSubCommon <= 0 THEN BREAK 2
SLEEP(0.2)
IF lTimeoutSeconds <= GETTIME() - lCurSeconds THEN EXIT
NEXT
NEXT
IF staticSemaphoreGetItemByThread_inSubCommon > 0 THEN EXIT
IF lTimeoutSeconds <= GETTIME() - lCurSeconds THEN EXIT
THREAD getItemByThread(lWID, lItemTypeConstants, lItemsNum, lListViewColumnsNum, lFlgRejectDisableItems)
FOR lJ=0 TO lTimeoutSeconds
FOR lI=0 TO 5
IFB staticSemaphoreGetItemByThread_inSubCommon <= 0 THEN
RESULT = TRUE; copyArray(staticAllItemList_inSubCommon, lAllItemList); EXIT
ENDIF
SLEEP(0.2)
IF lTimeoutSeconds <= GETTIME() - lCurSeconds THEN EXIT
NEXT
NEXT
FEND
PUBLIC staticSemaphoreGetItemByThread_inSubCommon = 0
PUBLIC staticAllItemList_inSubCommon[0]
PROCEDURE getItemByThread(lWID, lItemTypeConstants, lItemsNum=1, lListViewColumnsNum=1, lFlgRejectDisableItems=FALSE)
staticSemaphoreGetItemByThread_inSubCommon = staticSemaphoreGetItemByThread_inSubCommon + 1
GETITEM(lWID, lItemTypeConstants, lItemsNum, lListViewColumnsNum, lFlgRejectDisableItems)
copyArray(ALL_ITEM_LIST, staticAllItemList_inSubCommon)
staticSemaphoreGetItemByThread_inSubCommon = staticSemaphoreGetItemByThread_inSubCommon - 1
FEND