Nice generalisation!
I haven’t got a use for it at the moment, but I’m definitely going to tuck the
idea away in my toolbox.
Don
> On 22 Feb 2016, at 21:54, Jafar Al-Gharaibeh <to.ja...@gmail.com> wrote:
>
> This technique can be generalized such that the thread doesn't start until
> all arguments are ready, and arguments do not have to be ready or passed at
> thread creation time as follows:
>
> thread worker(<<@, <<@, <<@....)
>
> and worker() would be defined as
>
> procedure worker(arg1, arg2, arg3,...., argn)
>
> arg1...argn don't even have to come from one one place or even one thread.
> The thread/function is created in a suspended state, while the arguments
> trickle in "slowly" from different points/times.
>
> Cheers,
> Jafar
>
>
> On Mon, Feb 22, 2016 at 3:40 PM, Jafar Al-Gharaibeh <to.ja...@gmail.com
> <mailto:to.ja...@gmail.com>> wrote:
> I should also add, that Don didn't stop there, he used the <<@ not only to
> stop the thread at the beginning but also to pass a parameter to worker() in
> a "conventional" way. This is how worker() is declared:
>
> procedure worker(MyId){
> ....
>
> When <<@ is evaluated and something shows up in the queue, the result is
> passed down to "MyId" which makes passing the parameter (form worker()'s
> perspective) looks as a regular function call.
>
> That is double cool!
>
> --Jafar
>
>
>
> On Mon, Feb 22, 2016 at 3:25 PM, Steve Wampler <swamp...@noao.edu
> <mailto:swamp...@noao.edu>> wrote:
> On 02/22/2016 12:56 PM, Jafar Al-Gharaibeh wrote:
> > Greetings,
> >
> > A while back, Don Ward shared a threaded application with me written in
> > Unicon. I examined the source code today and
> > came across a very elegant use of some of the features. Here is the line
> > the impressed me the most:
> >
> > while 0 <= (n-:= 1) do { put(Workforce, id := ( thread worker(<<@)) ); id
> > @>> id }
> >
> > specifically:
> >
> > thread worker(<<@)
>
> That is cool!
>
> --
> Steve Wampler -- swamp...@noao.edu <mailto:swamp...@noao.edu>
> The gods that smiled on your birth are now laughing out loud.
>
> ------------------------------------------------------------------------------
> Site24x7 APM Insight: Get Deep Visibility into Application Performance
> APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
> Monitor end-to-end web transactions and take corrective actions now
> Troubleshoot faster and improve end-user experience. Signup Now!
> http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
> <http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140>
> _______________________________________________
> Unicon-group mailing list
> Unicon-group@lists.sourceforge.net <mailto:Unicon-group@lists.sourceforge.net>
> https://lists.sourceforge.net/lists/listinfo/unicon-group
> <https://lists.sourceforge.net/lists/listinfo/unicon-group>
>
>
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/unicon-group