From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,1742659b6aa943fb,start X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!g14g2000cwa.googlegroups.com!not-for-mail From: "Lucretia" Newsgroups: comp.lang.ada Subject: Tasking and wxWidgets Date: 25 Nov 2005 02:05:11 -0800 Organization: http://groups.google.com Message-ID: <1132913111.023558.255590@g14g2000cwa.googlegroups.com> NNTP-Posting-Host: 194.74.199.42 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1132913116 24426 127.0.0.1 (25 Nov 2005 10:05:16 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Fri, 25 Nov 2005 10:05:16 +0000 (UTC) User-Agent: G2/0.2 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8) Gecko/20051107 Firefox/1.5,gzip(gfe),gzip(gfe) X-HTTP-Via: 1.1 Symantec_Web_Security (3.0.1.74), 1.0 C2100-0050414028 (NetCache NetApp/5.5R5) Complaints-To: groups-abuse@google.com Injection-Info: g14g2000cwa.googlegroups.com; posting-host=194.74.199.42; posting-account=G-J9fgwAAADgpzBiEyy5tO4f8MX5fbpw Xref: g2news1.google.com comp.lang.ada:6610 Date: 2005-11-25T02:05:11-08:00 List-Id: I've posted this to the wxWidgets development list, but I thought I'd post here as well to get the Ada perspective. I'm probably going to answer my own question here, but here goes... I know that wxWidgets isn't thread-safe. I know that the advice given is to only do GUI related things in the main thread and to use worker threads as and when required to do other stuff and post the results back to the main thread via some sort of intermediary event queue or somesuch. But, there are a few things I would like to discuss with other developers here before I decide what to do with respect to wxAda. 1) Is there any situation where having multiple threads with it's own (or shared) GUI makes sense? Can anybody actually think of any examples where, say, a frame has multiple threads and they all (or some) want to update the GUI? As an example, say you have an monitoring application which has on it a number of controls, e.g. temperature, pressure guages, It would be possible to set up two threads which monitor the actual sensors and send events directly to the temperature/pressure wxGuage controls. Another example would be to provide a log window in which error messages from these same sensors could be dumped, in this case the wxEvtHandler derived class is accessed by two different threads concurrently and would need t synchronised. 2) How portable wuold this be exactly? Could I compile the same code and have it work correctly on Linux, Win32 and MacOS? Now, coming round to wxAda, I need to determine what exactly to do: 1) I could provide no support for tasking (multithreading) and require that the application developer protect his/her own code. 2) I could also go the other way and inside the wx.Base.Object.Object_Type (wxObject) provide a mutex object, such that every call in wxAda would lock (on entry) and unlock (on exit) thus providing thread safety if that particular object were accessed via multiple tasks. The overhead of constructing/destructing a mutex locker object, locking/unlocking the mutex object on every call would be rather high and thus, would most probably slow the application down to a crawl (although, not tested). Use of inlining might make this nicer? 3) I could go part-way and only provide concurrent access to the event sending functions. 4) Is it possible that the synchronisation code that *is* in the wxWidgets library (I'm not talking about the actual wxThread, wxSemaphore, etc. classes here, but the places where there is critical sections to protect concurrent access) could interfere with Ada's tasking and protected types (Ada's implementation of monitors)? Thanks, Luke.