Wow, I think this will make my head hurt way more than co-expressions.  It 
seems to me amazing that this level of elegance just seemed to flow naturally.
David

 
      From: Jafar Al-Gharaibeh <to.ja...@gmail.com>
 To: Don Ward <d...@careful.co.uk> 
Cc: Steve Wampler <swamp...@noao.edu>; Unicon 
<unicon-group@lists.sourceforge.net>
 Sent: Monday, February 22, 2016 5:26 PM
 Subject: Re: [Unicon-group] Fun with Threads
   
A side effect of this would be the ability to pass arguments that are not 
confined to the thread/co-expression frame. Instead of having a snapshot of an 
argument saved, you are passing it directly through a "side" tunnel.
Furthermore, I assume you can take this one step farther and do something like 
this:            t := thread worker(<<@, @>&parent)    <<@t   write (" The 
worker is up and running")
 A two-way synchronization solution that is completely transparent to worker().
               --Jafar

On Mon, Feb 22, 2016 at 3:58 PM, Don Ward <d...@careful.co.uk> wrote:

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> 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> 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
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
_______________________________________________
Unicon-group mailing list
Unicon-group@lists.sourceforge.net
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


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

Reply via email to