----boundary-LibPST-iamunique-1884096778_-_-
Content-type: text/plain
Doug,
> I have implemented a module GftThreads that works for simple tasks and
> operates in nanosecond response times (16ns on my machine).
I've played a little with your module, and make it work a little better by
using critical sections. But it's far from perfect, because threads can work
only if all parts of the same program collaborate. It's not the case of the
BB framework. Input/output procedures, for example, can't work concurrently.
You can look at my small example below: all works well during 1 or 2
seconds, until something is done by the system, that crashes BB.
Concurrent multitasking is a very difficult problem, which must be mastered
from the bottom. BB has not been built for that. For an example of multitask
Wirthian system, very close to BB, you can look at Bluebottle:
http://bluebottle.ethz.ch/
The only way I see to use a concurrent thread in BB is not to allow it to
call BB common resources, such as input/ouput procedures, or modules (or
objects) that contain global variables, etc... and to communicate with it by
some global variables protected by critical sections. Not very friendly.
For more informations on threads, I find the Microsoft SDK docu rather
clear.
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
Cheers.
Gérard
PacCoder.Decode
/I:.Pk/h.5..:k....6...0FO1NxE/.6/2EPc1ur.F3lJ/fD.CoTtyafYUnbEtk8QN5S7o0QP5D5
.4i/cr.is6lfUSOCs8gJ0N9jUPlzr0609V2rPg4rbbbSgNoMnk00Hn58BwbulZ8SIbdEctEVUrVz
mNG3jyZWtFpzR2h8Gi5CcHsCcJRBGJ8hrzI9TBniRGHv53qG:Kjw/uby45y4:VD.iPts6zD.WfrD
/L4tstQb1kSyS/7XdWJZHkn/Z2ahnkEpJ7wLryEvdbLCDkMhgsz1qRbcgbIMz1ad5RtXgGNEJXHr
BUYQRhBUOCQBUdqQBURNCP9rr1gmymGKNEwJln/7lzQSv6mjimlntRUwMP.tCqtrMTYhTaKwq:dw
q1du8P7yCPDbakKN:PPkH0P86zvBXpbramBEbMNTLtgXiP6HLZHak8nalOmnMUSyinwhq4r9FNux
hLZdwJtmovQh9yg3Z:FvGwb6MllfwV6e/L:laXjJn4asn1cSfbLjzJQxBL/Z1ljMfZ4fWJcJQUaT
vdLCFbJneJnMJmdMoDuiO1x1gJlNJlWTpQO9lbyP.gjME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rHyYf7vHOTx1bCTYaaVLY
yvTifTQ8wzSzmThJaXGrLHyxq2IhrF:z9KCHmwQtYrMEpSSTDyYwj14ezz2euHhQ4yRu9Dhyyd6h
JZrz1xyRD2y5mejq5WzNyzSzSxw48BwZU9PqTzPOYfY9w9:n53sVL5nFlB2x9/2KO6d7eOf:z9mb
pD:tNT6bsuvf:ytuC/TTlF5DC0xdrbzRzQPvEsi/yb4XCBhsgxrnExnBKUdjS3D5uSjLHa4xxdjx
Bw/EEXrVyHRD2uFt4ynzbvomywPmtRPbslkNQixvBm1vScR9Ll/NzkFg4QvPUbaxztf8PEqrKXmp
wDEjTkMyvf7w4MRtTveRgm8yNmSrbjkzBZbOO2yYjLhwlo7yMEqnSN8Hz:6ZrzG.Inn03.vHm2y6
wWeVD7.E/2E.
AtEndOfEncoding
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
----boundary-LibPST-iamunique-1884096778_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9sO30NCntcZjNcZm1vZGVyblxmY2hhcnNldDAgQ291cmllciBO
ZXc7fX0NCntcY29sb3J0YmxccmVkMFxncmVlbjBcYmx1ZTA7XHJlZDBcZ3JlZW4wXGJsdWUyNTU7
fQ0KXHVjMVxwYXJkXHBsYWluXGRlZnRhYjM2MCBcZjBcZnMyMCBEb3VnLFxwYXINClxwYXINCj4g
SSBoYXZlIGltcGxlbWVudGVkIGEgbW9kdWxlIEdmdFRocmVhZHMgdGhhdCB3b3JrcyBmb3Igc2lt
cGxlIHRhc2tzIGFuZFxwYXINCj4gb3BlcmF0ZXM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