|
|
Home » U++ Library support » U++ MT-multithreading and servers » MT on Linux?
MT on Linux? [message #14762] |
Thu, 13 March 2008 16:08  |
mrjt
Messages: 705 Registered: March 2007 Location: London
|
Contributor |
|
|
I was just wondering whther anyone is using multi-threading on Linux, as I'm having a variety of problems with it. Basically I have two programs with a client/server relationship. Both are Upp, server is a console app and the client has a GUI.
This works perfectly on Windows, but on Linux (KDE) I'm seeing the following problems:
1- Running a single thread in the server causes many (10+) seemingly identical processes to be added (as visible on the task-manager equivalent). Why?
2- I still see the issue that Chameleon only works in MT mode.
3- The GUI app has heap leaks that only appear when compiled with MT. I have tested this on a literally empty program (just GUI_APP_MAIN { }) and they still occur. This is particularly annoying because of (2), and I suspect these issues may be related.
4- It's very easy to make the GUI lock-up. I'm doing this:
Main window with progress bar
Thread doing something across the network
Thread updates the progress bar (via callback)
On network error the thread trigger a callback that does the following, then exits the thread:
void OnError(String txt)
{
Exclamation(txt);
wnd.Close();
SetExitCode(2);
}
The main window locks up after the Close call.
The only similar problem I had with Win32 was that it's possible to trigger the ASSERT(!IsPainting()) in Ctrl::WindowProc if you call Exclamation at the wrong time, and I can't see way to do any sort of lock since IsPainting is private.
I know I should submit some test cases, but I'm going to try installing a native GTK distribution first and see if the problems persist. Am I the only one having these problems?
Cheers,
James
[Updated on: Thu, 13 March 2008 16:09] Report message to a moderator
|
|
|
|
|
|
Re: MT on Linux? [message #15421 is a reply to message #15407] |
Wed, 23 April 2008 10:13   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
nixnixnix wrote on Mon, 21 April 2008 17:15 | Hey James, no you're not the only one. My app runs for a while with one thread for the interface and one thread doing the work of optimising my windfarm then after maybe 20 iterations it will completely lock up for no discernible reason. I am using Ubuntu 7.10.
I also got the MessageBox error in Win32 when calling PromptOK from a thread that I've made. However, I figured this was reasonable behaviour and so now I call all my message boxes from the main thread which I think is better (Just IMO)
Nick
|
There was a very fatal (and extremely stupid too) error in Linux/MT recently fixed.
Quick patch:
inline int AtomicXAdd(volatile Atomic& t, int incr) { using namespace __gnu_cxx; return __exchange_and_add(&t, incr); }
inline int AtomicInc(volatile Atomic& t) { return AtomicXAdd(t, +1) + 1; }
inline int AtomicDec(volatile Atomic& t) { return AtomicXAdd(t, -1) - 1; }
Please try, I believe this will help. I have encountered this problem while testing new "CoWork" reference example.
Without this fix, example crashes within 30s. With it, it was running 24 hours until I finally closed it.
Sorry for this problem, it was stupid mistake. MT is sometimes tricky 
(And of course, it is not unlikely there are more problems like this one... but definitely, this will fix a lot of issues).
Mirek
|
|
|
|
|
|
Re: MT on Linux? [message #15441 is a reply to message #15439] |
Wed, 23 April 2008 21:26   |
nixnixnix
Messages: 415 Registered: February 2007 Location: Kelowna, British Columbia
|
Senior Member |
|
|
I guess it could be but I am not using Mutex anywhere in my code. In the case I am describing I am only using MT to stop the main GUI thread from locking up so it can repaint and respond to user actions and it all works fine in Win32.
Nick
[Updated on: Wed, 23 April 2008 21:27] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Mon Apr 28 20:40:49 CEST 2025
Total time taken to generate the page: 0.00988 seconds
|
|
|