` Printed Icetips Article

Icetips Article



ABC: C5B - Open and Close method problem - fix
1999-12-22 -- Mike Hanson
 
Newsgroups: topspeed.products.c5ee


I'm not actually sure what problem your having, but I'll guess that
it's having files not opened that should be.  Try this.  Open
ABFILE.CLW and look for FileManager.OpenServer.  Add the marked lines
so that it looks like this:

    IF ForceOpen OR ~SELF.LazyOpen AND ~SELF.Info.Opened
      RVal = SELF.OpenFile(HandleError)
      IF RVal
        RETURN RVal
      END
    ELSIF SELF.Info.Opened            !***MH
      OPEN(SELF.File,SELF.OpenMode)  !Ignore Error ***MH
    END

This is actually caused by a bug in the File management code.  There's
an "Info" queue that is used to hold the file state for each thread.
When the last procedure in a thread closes, the queue is not cleared.
Therefore, it can sometimes be in a "bad" state when a new stream of
procedures reuses that thread number.  This solves the problem.  Catch
you later!

-=> Mike Hanson <=-
www.BoxsoftDevelopment.com


rlerner@ix.netcom.com (Robert J. Lerner) wrote:

>Hi Russ,
>
>Thanks for responding so quickly.
>
>>Don't use OPEN(File) and CLOSE(File).  ABC will handle this for you.  If you
>>must handle it yourself, then use the methods in the RelationManager.
>
>Russ, I know you can't really respond without seeing the code- but I
> use Open/close(file), and always  use the RelationManager
>methods when I need to override the templates because of a File Not
>Open error.
>
>Nothing I do seems to work. I've tried the change Mike Hanson
>suggested-
>
>UseFile PROCEDURE(BYTE UseType=UseType:Returns),BYTE,PROC
>
>to no avail. I've tried explicity relate.closing/relate.opening all
>template-opened files before/after calling some proc which uses the
>same files.
>
>Question: sometimes files are lazy opened and sometimes not. Where is
>the governing logic?
>
>Another question: Is there no way TS could have some setting where the
>unopened files are simply opened to some pre-proc2-call state?
>
>Russ, it's so damn frustrating to lose two days on something that
>should be so easy to track down and fix. This is what I hate about
>OOP.
>
>Thanks again for your help, and have a nice holiday.
>



Printed November 23, 2024, 2:21 am
This article has been viewed/printed 35392 times.
Google search has resulted in 33 hits on this article since January 25, 2004.