Alaska Software Inc. - Thread / PUBLIC / PRIVATE
Username: Password:
AuthorTopic: Thread / PUBLIC / PRIVATE
AUGE_OHRThread / PUBLIC / PRIVATE
on Wed, 23 Jul 2008 04:00:15 +0200
hi,

i do have some PUBLIC like "zPATH" in my Main for the hole
Application which are filled from Ini at startup.

now "sometimes" i got such Message:
*** snip ***
------------------------------------------------------------------------------
ERROR LOG of MEZI Ver.x2.111d "C:\YIUIMEX\XPPYIU.EXE" Date: 21.07.08
12:24:22

Xbase++ version     : Xbase++ (R) Version 1.90.331
Operating system    : Windows XP 05.01 Build 02600 Service Pack 3
Memory (RAM_AVAIL)  : 302.08 of 524.29 MB
DiskSpace C:        : 37662.42 MB
Alias()             : leer
Recno()             : leer
Found()             : NO
NetError()          : NO
Select()            : 25
IndexOrd()          : 0
WorkSpaceList       :
KUNDEN : NO Record locked
ARTIKEL : NO Record locked
LIEFER : NO Record locked
BESTAND : NO Record locked
ABZU : NO Record locked
------------------------------------------------------------------------------
ASCOM10.DLL    : Xbase++ Runtime DLL, Hotfix Rollup #19 for Xbase++ 1.90.331
ASCOM10C.DLL   : 1.90.0331 Xbase++ Runtime DLL Hotfix Rollup #16
ASRDBC10.DLL   : 1.90.0331 Xbase++ Runtime DLL
CDXDBE.DLL     : 1.90.0331 Xbase++ Runtime DLL
DBFDBE.DLL     : 1.90.0331 Xbase++ Runtime DLL
FOXDBE.DLL     : 1.90.0331 Xbase++ Runtime DLL
NTXDBE.DLL     : 1.90.0331 Xbase++ Runtime DLL
XPPDBGC.DLL    : 1.90.0331 Xbase++ Runtime DLL
XPPNAT.DLL     : 1.90.0331 Xbase++ Runtime DLL
XPPRT1.DLL     : 1.90.0331 Xbase++ Runtime DLL Hotfix Rollup #13
XPPUI1.DLL     : 1.90.0331 Xbase++ Runtime DLL, Hotfix Rollup #12 for
Xbase++ 1.90.331
XPPUI2.DLL     : 1.90.0331 Xbase++ Runtime DLL
------------------------------------------------------------------------------
oError:args         :
           -> NIL
oError:canDefault   : N
oError:canRetry     : J
oError:canSubstitute: N
oError:cargo        : NIL
oError:description  : Unbekannte Variable
oError:filename     :
oError:genCode      :         22
oError:operation    : zPath
oError:osCode       :          0
oError:severity     :          2
oError:subCode      :       2000
oError:subSystem    : BASE
oError:thread       :          4
oError:tries        :          1
------------------------------------------------------------------------------
CALLSTACK:
------------------------------------------------------------------------------
Called from OPENCHINA(867)
Called from AABGANG(262)
Called from ABTHREAD3(5765)
Called from ABTHREAD2(4067)
------------------------------------------------------------------------------
Thread          4
------------------------------------------------------------------------------
{1, 444, 4025, "ABTHREAD1", thread}
{3, 960, NIL, NIL, thread}
{4, 1164, 544, "ERRORLOG", thread}
------------------------------------------------------------------------------
*** eof ***

but  zPATH is PUBLIC ...  ???

as you can see i do have start from "ABTHREAD1" which will
call next Thread "ABTHREAD2" to start Thread "ABTHREAD3"

it does work if i test it and i can "see" my PUBLIC in Debugger ...

same "sometimes" happend with a other PUBLIC "ID_USER"
if a have a Error in a Thread which was called from other Thread.

so what can be "sometimes" the Reason that i can not "see"
my PUBLIC in a Thread ... which was called from other Thread ?

greetings by OHR
Jimmy
Hannes ZieglerRe: Thread / PUBLIC / PRIVATE
on Thu, 24 Jul 2008 03:58:38 +0200
Jimmy,

> i do have some PUBLIC like "zPATH" in my Main for the hole
> Application which are filled from Ini at startup.

JFYI, I completely got rid of PUBLIC variables by maintaining ONE single 
PUBLIC variable holding a single hash table. This way, I've reduced my pool 
of PUBLIC variables from MANY to ONE. Xbase++ maintains only ONE PUBLIC 
variable for me, while I control the rest. This gives me full control over 
my globally visible variables (A single hash table is visible across all 
threads in the entire application).

When I need a new value in this globally visible pool of variables, I add an 
entry to the hash table, I don't create a new PUBLIC variable. This entry is 
immediately visible across all threads.

If this technique is of interest for you, you are invited to test it for 
free with "The Yukon Project" Demo version.

Regards,
--
Hannes

PS:
The Demo of "The Yukon Project" is available for download at this link:
http://www.knowlexbase.com/en/software/yukon/demo/index.html
AUGE_OHRRe: Thread / PUBLIC / PRIVATE
on Thu, 24 Jul 2008 09:50:33 +0200
hi,

> JFYI, I completely got rid of PUBLIC variables by maintaining ONE single
> PUBLIC variable holding a single hash table. This way, I've reduced my
> pool of PUBLIC variables from MANY to ONE. Xbase++ maintains only ONE
> PUBLIC variable for me, while I control the rest. This gives me full
> control over my globally visible variables (A single hash table is visible
> across all threads in the entire application).

Yes i understand and i do use something like that in a
Array to hold my "ex. GET" Memvars.

i do use #translate to access Array Elements and the
"Names" are the still same as my old Memvars so i do
not have to modify my old Cl*pper Source

*** snip ***
#xtranslate mARTNR       => ::Stack\[::nDim,1]

...
@x,y GET mARTNR

.or.

oSLE:datalink := VarBlock(@mARTNR)

*** eof ***
as you can seen i use ::nDim Array so i can use MDI
with it and i can "transfer" from one MDI into other MDI

In my WMPlayer i can hold Objects like Bitmaps and
read them from all Threads so if user drop new Bitmap
on Main:drawingArea it will change all Thread MDI
:drawingArea:bitmap or change them to Transparency.



but back to my PUBLIC Problem :
im not shure if im able to run a "new" Function when i
got into Errorsys ? Thats why i still have some PUBLIC like
ID_USER or zPATH for my Errorsys Logfile.

i have open this Thread while i did have that Problem since
i start with Threads in Xbase++ Hybrid Mode. I can not force
it but i have seen a lot of Errorlogs so i can say :

1.) it never have happend in "full GUI" Mode only Hybrid
     (perhaps while i open all DBF in "full GUI" Mode and
      leave them "open" while under Cl*pper i did WSLclose()
     allways on hole Workspace after return from Procedure )

2.) it is allways in a new Thread when called from a Thread
3.) it did happend with PUBLIC and PRIVATE (both in Main declared)
4.) local and Network
5.) i did have a ID_USER and zPATH Entry in my DBF Logfile that
     other DBF have opend just before without Error.

*** snip ***
IF NET_USE(zPATH+"Artikel")    have been open (see Errorsys)
    IF OpenChina()
        SELECT ARTIKEL
        SET RELATION TO ARTIKEL->ARTNR INTO CHINABMP
...

FUNCTION OpenChina()
LOCAL nOldSel := SELECT()
...
SELECT 26           fix ALIAS() SELECT Numbers
IF .NOT. USED()
    IF NET_USE(zPATH+"ChinaBMP")  <--- Error zPATH = NIL ?

*** eof ***

6.) it seem to happend on Monday mostly. ( very busy User )
7.) OS() allways XP with SP2 or SP3. (also on XP64 with SP)
    I never have seen W2K with that Type of Error !?
    i do not use Win98 any more and no VISTA

so did someone else what "might happend" and how to force it ?

greetings by OHR
Jimmy
Hannes ZieglerRe: Thread / PUBLIC / PRIVATE
on Fri, 25 Jul 2008 05:11:33 +0200
Hi Jimmy,

> i do use #translate to access Array Elements and the
> "Names" are the still same as my old Memvars so i do
> not have to modify my old Cl*pper Source
>
> *** snip ***
> #xtranslate mARTNR       => ::Stack\[::nDim,1]
>
> ...
> @x,y GET mARTNR
>
> .or.
>
> oSLE:datalink := VarBlock(@mARTNR)

You are in an excellent situation to reduce your PUBLIC variables:

<!-- -->
#xtrans mARTNR => globalVars:mARTNR

PROC MAIN
   PUBLIC globalVars := HashTable()

   globalVars:mARTNR := "my value"
   ...
RETURN
<!-- -->

The fact that your #xtrans directive is resolved to "self:Stack" makes the 
HashTable() approach very promising. Self receives a message and HasTable 
receives a message. There shouldn't be any performance hit in changing to 
HashTable.

Regards,
--
Hannes