[clean-list] Process starting
Marco Kesseler
m.kesseler at xs4all.nl
Wed Mar 8 22:57:42 MET 2006
Arjen van Weelden schreef:
> Hernyák Zoltán wrote:
>> Because my task is to write programs which sends and receives data
>> from outside.
>> This is a kind of port-reading-writing problems, where on the other
>> side a 3rd party
>> program processes the data elements.
>>
>> The main program is a kind of:
>>
>> Start w =
>> #! w = sendAllData [1...10000] w
>> #! (result,w) = receiveAllData w
>> = result
>>
>> This cannot work, because until all the elements of [1..1000] is not
>> sended,
>> nothing is received. Let suppose, the 3rd party program reads one
>> data element from the
>> port, and sends it back immediately on a synchronized way. So until
>> the succesfull receiving it won't
>> read another data element from the port. The only idea is to solve is
>> that:
>>
>> Start w =
>> #! w = sendAllData_OnSeparateThread [1...10000] w
>> #! (result,w) = receiveAllData w
>> = result
>>
>> So it can't be solved in Clean?? I barely think that :)
>>
>> Zoltan Hernyak
>
> It still looks as if two separate programs, or a single program
> started twice, could solve your problem, in combination with a TCP/IP
> library.
That depends I guess, on whether the writer should communicate with the
sender while they are both doing their job, and how complex this
interaction is. I think it would not be far-fetched if the sender sends
different data, depending on the reply so far.
Personally, I think that support for multi-threaded execution would be a
serious enhancement. I wouldn't mind a small performance hit.
> Anyway, the example I sent you can be combined with Clean's TCP/IP
> library to do just that. The TCP/IP library, which is part of Object
> I/O, can also be used without Object I/O. Just select an unused port
> and setup a server in the main thread that receives data from the
> separate thread/process client. Take a look at ...Clean
> 2.1.1\Examples\Tcp Examples\chat\chat{Client|Server}.icl. This can
> easily be incorporated into the example containing newProcess that I
> sent you.
>
> regards,
> Arjen
>
> (one more thing: don't use so many #!'s, they are hardly ever necessary)
>
Well, that depends on your view of what constitutes the most readable
program :-)
For example, I actually have come to apreciate writing brackets instead
of relying on priorities...
And once in a while, I find the indentation rules annoying, and the
semicolon becomes my friend...
(couldn't resist)
cheers,
Marco
More information about the clean-list
mailing list