- GftThreads

From: Douglas G. Danforth <"Douglas>
Date: Thu, 28 Apr 2005 12:46:21 -0400

----boundary-LibPST-iamunique-199429704_-_-
Content-type: text/plain

René,
Thank you for your comments. They are are not very encouraging but useful.
-Doug

René Dorta wrote:
> We have been experimenting with windows threads in Component Pascal for
> a long while. As a matter of fact we have implemented a subset of
> MODULA-3 thread interface in Component Pascal. I can mention the most
> striking troubles we have run into:
>
> 1. Threads can not use Out or StdLog. We have develop /ad hoc/
> modules for multi-thread output.
> 2. Neither can they use ASSERT: if the assertion fails the system
> will hang up. The big problem is that Run Time Support, and
> BlackBox modules do use ASSERT, so even if your code avoid it you
> can be trapped and hang the system up.
> 3. Don't use HALT.
> 4. Finally: garbage collection is not thread safe. Which is a very
> big problem! (It was pointed out to us by Oberon Microsystem at
> the very beginning of our project).
>
> Cheers:
> René Dorta. Universidad de Carabobo. Venezuela.
>

> Douglas G. Danforth wrote:
>
>> Folks,
>> I have implemented a module GftThreads that works for simple tasks and
>> operates in nanosecond response times (16ns on my machine).

>> The simple interface (patterned a little after Services.Action) looks
>> like.
>>
>> DEFINITION GftThreads;
>>
>> TYPE
>> Action = POINTER TO ABSTRACT RECORD
>> (a: Action) Do, NEW, ABSTRACT;
>> (a: Action) Start, NEW;
>> (a: Action) Stop, NEW
>> END;
>>
>> END GftThreads.
>>
>> Calling action.Start puts the function action.Do into a tight loop
>> running in a child thread. Calling action.Stop from the parent
>> terminates this loop and the thread. The child shares the memory
>> space of the parent.
>>
>> However, I am getting in over my head. The functions that the user
>> places in action.Do must be 'thread-safe'. Neither Out.String, nor
>> XYplane.Dot seem to satisfy the 'thread-safe' condition. They both
>> work for a single Start-Stop pair but a second Start causes the
>> system to hang (for Out there seems to be an interaction with the
>> routines that write to the log and preconditions are violated).
>>
>> I would like the user not have to worry about 'thread-safety' and so
>> believe something like critical regions are necessary.
>>
>> Does anyone have experience with Windows' threads that could give some
>> pointers?
>>
>> -Doug
>>
>> --- BlackBox
>> --- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
>>
>>

--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy



----boundary-LibPST-iamunique-199429704_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0KXHVjMVxwYXJkXHBsYWluXGRlZnRhYjM2MCBcZjBcZnMyMCBSZW5cJ2U5LFxwYXINClRoYW5r
IHlvdSBmb3IgeW91ciBjb21tZW50cy4gIFRoZXkgYXJlIGFyZSBub3QgdmVyeSBlbmNvdXJhZ2lu
ZyBidXQgdXNlZnVsLlxwYXINCi1Eb3VnXHBhcg0KXHBhcg0KUmVuXCdlOSBEb3J0YSB3cm90ZTpc
cGFyDQo+IFdlIGhhdmUgYmVlbiBleHBlcmltZW50aW5nIHdpdGggd2luZG93cyB0aHJlYWRzIGlu
IENvbXBvbmVudCBQYXNjYWwgZm9yIFxwYXINCj4gYSBsb25nIHdoaWxlLiBBcyBhIG1hdHRlciBv
ZiBmYWN0IHdlIGhhdmUgaW1wbGVtZW50ZWQgYSBzdWJzZXQgb2YgXHBhcg0KPiBNT0RVTEEtMyB0
aHJlYWQgaW50ZXJmYWNlIGluIENvbXBvbmVudCBQYXNjYWwuIEkgY2FuIG1lbnRpb24gdGhlIG1v
c3QgXHBhcg0KPiBzdHJpa2luZyB0cm91YmxlcyB3ZSBoYXZlIHJ1biBpbnRvOlx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