A nice replacemente for the sender sender sender sender sender sender WTF :)

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

A nice replacemente for the sender sender sender sender sender sender WTF :)

Guillermo Polito
I've just noticed that the following expression:

    InMidstOfFileinNotification signal ifFalse: [ ...

Is to notice if I'm in the middle of the file in.













amazing,
Guille
Reply | Threaded
Open this post in threaded view
|

Re: A nice replacemente for the sender sender sender sender sender sender WTF :)

Igor Stasenko
On 5 May 2012 01:06, Guillermo Polito <[hidden email]> wrote:
> I've just noticed that the following expression:
>
>     InMidstOfFileinNotification signal ifFalse: [ ...
>
> Is to notice if I'm in the middle of the file in.
>
>
unless there is another process who InMidstOfFilein.

IMO one should use plain boring semaphores and critical section,
because exceptions have effect on current process, but completely
ignorant to what happens
in other ones.

just to test , add the following test:

sema := Semaphore new.

[ sema signal. self fileIn: '20 seconds asDelay wait' ] fork.

sema wait.
self should: (self fileIn: '20 seconds asDelay wait') raise:
InMidstOfFileInErrorOrWhatever.

>
>
>
>
>
>
>
>
>
>
>
> amazing,
> Guille



--
Best regards,
Igor Stasenko.

Reply | Threaded
Open this post in threaded view
|

Re: A nice replacemente for the sender sender sender sender sender sender WTF :)

Igor Stasenko
On 5 May 2012 03:11, Igor Stasenko <[hidden email]> wrote:

> On 5 May 2012 01:06, Guillermo Polito <[hidden email]> wrote:
>> I've just noticed that the following expression:
>>
>>     InMidstOfFileinNotification signal ifFalse: [ ...
>>
>> Is to notice if I'm in the middle of the file in.
>>
>>
> unless there is another process who InMidstOfFilein.
>
> IMO one should use plain boring semaphores and critical section,
> because exceptions have effect on current process, but completely
> ignorant to what happens
> in other ones.
>
> just to test , add the following test:
>
> sema := Semaphore new.
>
> [ sema signal. self fileIn: '20 seconds asDelay wait' ] fork.
>
> sema wait.
> self should: (self fileIn: '20 seconds asDelay wait') raise:

oops, the above is of course should be:

 self should: [self fileIn: '20 seconds asDelay wait'] raise:

but i think you got an idea.

> InMidstOfFileInErrorOrWhatever.
>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> amazing,
>> Guille
>
>
>
> --
> Best regards,
> Igor Stasenko.



--
Best regards,
Igor Stasenko.