[V4RB] Semaphores and subclassing vCursor - Solved

Ruslan Zasukhin sunshine at public.kherson.ua
Sat Jul 31 07:43:24 CDT 2004


On 7/31/04 5:11 AM, "Keith DeLong" <delong at redcort.com> wrote:

> 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


Good idea, Keith!


> 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?

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: ruslan at paradigmasoft.com
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------



More information about the Valentina mailing list