[m-users.] An example for thread communication

Volker Wysk post at volker-wysk.de
Tue Nov 7 04:22:02 AEDT 2023


Hi!

For learning thread programming, I've written an example program. This is
finished, and I think it would be a good addition for the
samples/concurrency folder in the Mercury sources.

I have a number of worker threads, which are feeded work over a channel. The
workers send the results back via another channel. A feeder thread sends all
the work and a collector thread (the main program) collects the results. I'm
using a semaphore for synchronisation, in order to avoid to send all the
work items to the work channel immediately, at the beginning.

I would polish it some more, and add a description, if it is accepted. I've
attached the current version.

Cheers,
Volker

-------------- next part --------------
A non-text attachment was scrubbed...
Name: thr3.m
Type: text/x-matlab
Size: 8431 bytes
Desc: not available
URL: <http://lists.mercurylang.org/archives/users/attachments/20231106/d4fae93b/attachment-0001.bin>


More information about the users mailing list