« Sympl: an example of language implementation using the DLRScrum Coffee (Paris, 11 février) »

5 comments

Comment from: yann schwartz [Visitor]
Hi,

The InUIThread is a nice extension method but on the other hand I find the InWorkerThread a bit icky, especially the busy wait on worker.IsBusy. Yes, the DoEvents will process Windows messages, but otherwise If the purpose is to have only one worker thread worker, you could have a wait on a waithandle. If you want to simply fire and forget and let the threadpool do its trick, why wait for completion in the first place?
03/19/09 @ 11:17
Comment from: Thibaut Barrère [Member] Email
Hi Yann,

yeah we share your feelings on InWorkerThread. It feels a bit weird.

The use case behind that is to have some way to disable most of the UI (form.controls.first.enabled = false) while leaving it responsive, when a long process (import) runs in the background and reports now and then.

We coded the same behaviour using a background worker, but we didn't like the syntax.

So we came up with that, which is a kind of syntactic symetrical of InUIThread (used all over the place).

Using it feels right in our case, but the implementation sounds weird. Playing with IsBusy and DoEvents is not something I find robust.

Anyway - InUIThread matches a good 95% of our use.

Do you use an InUIThread equivalent ? Or do you rely on BackgroundWorker ?

I'd be interested to have some real-life feedback.

cheers and thanks for your comment.

-- Thibaut
03/19/09 @ 11:57
Comment from: Patrick Smacchia [Visitor] · http://www.NDepend.com
Related to this topic, a pretty tricky implementation of the pattern 'Overridable Task' we use in NDepend. It is based on BackgroundWorker, and here are detailled explanations:

http://codebetter.com/blogs/patricksmacchia/archive/2008/06/10/backgroundworker-closure-and-overridable-task.aspx
03/20/09 @ 07:11
Comment from: Thibaut Barrère [Member] Email
Hi Patrick,

thanks for the link!
03/20/09 @ 08:33
Comment from: Yann Schwartz [Visitor]
Usually we rely more the WindowsSynchronizationObject, which offers a bit more flexibility on where the async task was started in the first place. But the backgroundWorker is a nice, not too trap-ridden way to have painless UI related async tasks. Unfortunately, since I mostly have to cope with .Net 2.0 code, the fancy lambda and extensions methods helpers morph into ugly anonymous delegates and static helpers.
03/20/09 @ 20:20

This post has 2 feedbacks awaiting moderation...

Leave a comment


Your email address will not be revealed on this site.

Your URL will be displayed.
(Line breaks become <br />)
(Name, email & website)
(Allow users to contact you through a message form (your email will not be revealed.)
This is a captcha-picture. It is used to prevent mass-access by robots.
Please enter the characters from the image above. (case insensitive)