alternative to nextOrNil for SharedQueues on VW?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

alternative to nextOrNil for SharedQueues on VW?

Rick Flower
I'm moving some code that normally lives in the land of Squeak and it
uses their SharedQueue>>nextOrNil method to ensure no blocking occurs if
the queue is empty.. It sounds like I might be able to gen something up
with using VW's SharedQueue>>peek which can return nil (but doesn't
return anything off the queue).. Does anyone have any implementation of
this method that you use for VW?

Also -- for cases like this where you're adding functionality to
"factory provided classes", how do you ensure those changes/additions
don't get lost when upgrading from version X to version Y of VW?

Thanks!

Reply | Threaded
Open this post in threaded view
|

Re: alternative to nextOrNil for SharedQueues on VW?

Martin McClure
Rick Flower wrote:
>
> Also -- for cases like this where you're adding functionality to
> "factory provided classes", how do you ensure those changes/additions
> don't get lost when upgrading from version X to version Y of VW?

If you're adding a method to a base class, add the method in your own Store package. Then when you load your application from Store into any VW version, the method will be added.

Regards,

-Martin

Reply | Threaded
Open this post in threaded view
|

Re: alternative to nextOrNil for SharedQueues on VW?

Rick Flower
Martin McClure wrote:
> Rick Flower wrote:
>>
>> Also -- for cases like this where you're adding functionality to
>> "factory provided classes", how do you ensure those changes/additions
>> don't get lost when upgrading from version X to version Y of VW?
>
> If you're adding a method to a base class, add the method in your own
> Store package. Then when you load your application from Store into any
> VW version, the method will be added.

Thanks Martin -- I keep forgetting that the browser can play funny games
like that -- having pieces of one object located elsewhere (for lack of
a better way to describe it).. I'll have to try it to see how the
mechanics of it work -- I've seen things like that done w/ Glorp &
Seaside I believe but haven't tried myself.. Thanks!

Reply | Threaded
Open this post in threaded view
|

Re: alternative to nextOrNil for SharedQueues on VW?

Reinout Heeck
In reply to this post by Rick Flower

Rick Flower wrote:

> I'm moving some code that normally lives in the land of Squeak and  
> it uses their SharedQueue>>nextOrNil method to ensure no blocking  
> occurs if the queue is empty.. It sounds like I might be able to  
> gen something up with using VW's SharedQueue>>peek which can return  
> nil (but doesn't return anything off the queue).. Does anyone have  
> any implementation of this method that you use for VW?


If you copy the guts of the implementation of #next you end up with  
something like the following:

nextOrNil
        ^
        [accessProtect
                critical: [contents isEmpty ifTrue: [nil] ifFalse: [contents  
removeFirst]]]
                        valueUninterruptably





HTH,

Reinout
-------