On Wed, Nov 9, 2016 at 4:02 AM,  <pet...@riseup.net> wrote:
>
> There are my last 2 attemps. The first, commented out version finishes
> without waiting for the threads to finish (even with the ugly hack of
> reading the state>> of the thread) while in the second the receiving
> thread doesn't read the messages as they arrive, rather its mailbox gets
> filled up and only when everyone finishes gets time to work on the
> messages. What am I doing wrong?

Nothing seems to be wrong here, but there's no obvious thread join
operation to wait on completion so Factor exits immediately even if
active threads are running.

> On the topic of factor's cooperative threads - do they run multi- or
> single-core?

The are single core co-operative threads. If you run an FFI function
that  blocks then all threads block.

> If you have some other tips on the code I'll be glad, I feel like I'm
> doing more shuffling then I might need.

I tried to duplicate the basics of your code with the following:

self '[ "bash -c \"sleep 10\"" run-process drop 1 _ send ] "1" spawn
self '[ "bash -c \"sleep 5\"" run-process drop 2 _ send ] "2" spawn
receive

This will spawn two threads that run a bash 'sleep'. The 'receive'
blocks until the shortest sleep finishes and if you run another
'receive' then it blocks until the longer one completes. This should
be what your code does too. Are you sure the git commands aren't all
completing at the same time?

Note the use of the 'fry' quotation to avoid having to curry and swap
later to pass the 'self' around btw.

-- 
http://bluishcoder.co.nz

------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk

Reply via email to