[clean-list] Multithreading in Clean

Arjen van Weelden arjenw@cs.kun.nl
Mon, 14 Jun 2004 10:27:17 +0200


Hi,

Unfortunately, there is not real support for threads in Clean.

The easiest option is to make two programs that communicate using Object 
I/O TCP/IP receivers. The work/videoprocessing thread does not need to 
use Object I/O, because it TCP/IP library also works without it. The GUI 
program can use the TCP/IP channel just as any other receiver. This is 
explained somewhere in the Object I/O documentation.

If your really want both threads in a single program, you could put the 
videoprocessing in a DLL. With a straightforward C stub, the Clean code 
in this DLL can be started in a seperate thread.

The StdProcess module is part of the 'ancient' Concurrent Clean 
implementation, which current is out-of-order ;-).

Personally, i've written a thread simulation library, but it only 
supports cooperative concurrency, and does not work with Object I/O, and 
is probably not what you want.

Hope this helps,
	Arjen

XSet wrote:

> Hi, All!
> 
> Is any way to create multiple processing threads in Clean? For example, I need
> a main thread to process GUI and background thread to make videoprocessing. Of course there should be way to pass messages (communicate) to each other. I saw something about it in StdProcess. But in sources of Object IO I see only one OS Thread and one Clean Thread. I have possibility to emulate multiple threads, but in my task the videoprocessing thread should work apart the GUI thread.
> 
> I see Clean has very nice compiler, it would be great to use it for real task.
> 
> Thanks in advance.
> XSet