[V4RB] Semaphores and subclassing vCursor - Solved

Keith DeLong delong at redcort.com
Fri Jul 30 19:11:04 CDT 2004


Thought I'd answer my own question so it's in the archives for future
reference...

There's a way to subclass VCursor  without using db.SQLSelect. This
alternate way to get a populated cursor is described on page 62 of the V4RB
reference.

So the following methods allow the creation of thread safe vcursors.

Methods of Vcursor SubClass...

Sub Constructor (InDB as vDatabase, SqlString as string)
   V4RBSemaphore.Signal
   VCursor(InDB,SqlString,kV_Server, kV_NoLocks, kV_Random)
End Constructor

Sub Destructor 
   V4RBSemaphore.Release
End Destructor


Keith DeLong



> I'm trying to implement a global semaphore to control thread access to
> Valentina. 
> 
> It occurred to me that since I use cursors exclusively, I could subclass
> Vcursor putting a semphore.signal in the the constructor and a
> semphore.release in the destructor.
> 
> However MySubclassedVCursor = db.SQLSelect(SQLString...) errors telling me
> the db.SQLSelect returns a vCursor.
> 
> I'd really like a solution that doesn't require manual adding a signal and
> release with each of my hundred or so cursor related methods. Such a
> solution seems both ineloquent and fragile as a single omission now or in
> the future would cause intermittent errors that could be quite difficult to
> track. 
> 
> Has anyone else pondered this and/or come up with a solution?
> 
> TIA,
> 
> Keith DeLong
> 
> 
> 
> 
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
> 



More information about the Valentina mailing list