|
|
Home » U++ Library support » U++ MT-multithreading and servers » GuiLock Example broken
GuiLock Example broken [message #22793] |
Mon, 17 August 2009 10:35  |
masu
Messages: 378 Registered: February 2006
|
Senior Member |
|
|
Hi,
I tried the GuiLock example and got the following error:
Assertion failed in d:\programs\upp-svn\uppsrc\Draw\DrawLock.cpp, line 32
sGLockLevel > 0
Whereas GuiMT example works fine.
Could it be MingW causing the troubles?
System: WinXP, MingW 4.3.0, SVN 1514
Matthias
|
|
|
|
|
|
|
|
|
|
|
|
Re: GuiLock Example broken [message #22829 is a reply to message #22813] |
Thu, 20 August 2009 17:52   |
masu
Messages: 378 Registered: February 2006
|
Senior Member |
|
|
Hi,
attached I provide a test package for explicit TLS using phreads.
I wanted to evaluate implicit TLS due to missing __thread storage qualification support on OpenBSD. What I discovered was a strange behavior with U++ Core package included.
It runs without problems when compiled in optimal mode without including U++ Core. But when I include Core U++ package I get segmentation faults all the time regardless if it is compiled in debug mode or optimal mode.
As far as I understand the only thing that is replaced by including Core package is heap implementation (in optimal mode) and since I use the heap to allocate and de-allocate memory for the TLS variables it is used instead of standard one. Is that right?
If I do not use heap allocated variables, but pre-allocated ones, I do not have any problems (This can be done by setting TLS_PRE_ALLOC to true).
Matthias
[Updated on: Fri, 21 August 2009 10:39] Report message to a moderator
|
|
|
|
|
|
Re: GuiLock Example broken [message #22841 is a reply to message #22838] |
Fri, 21 August 2009 14:33   |
 |
mirek
Messages: 14255 Registered: November 2005
|
Ultimate Member |
|
|
masu wrote on Fri, 21 August 2009 08:19 | Hi Mirek,
thanks for explanations, it seems, it was the call to free instead of delete that caused the crash ... (sorry about that).
I meant explicit TLS not implicit one in my prior post, will edit it to correct this one.
Thanks for now,
Matthias
|
Actually, if correct __thread is not available, U++ allocator cannot work in MT.
Maybe you should just USEMALLOC then... In any case, to stay on the safe side, you TLS implementation should use malloc/free (and maybe then you could use such TLS to make U++ allocator work, although any positive effects will be likely diminished by slow TLS).
Mirek
|
|
|
Re: GuiLock Example broken [message #22843 is a reply to message #22841] |
Fri, 21 August 2009 14:43   |
masu
Messages: 378 Registered: February 2006
|
Senior Member |
|
|
luzr wrote on Fri, 21 August 2009 14:33 | Actually, if correct __thread is not available, U++ allocator cannot work in MT.
|
I know, thats why I get problems on OpenBSD (at least I think so, at the moment).
luzr wrote on Fri, 21 August 2009 14:33 | Maybe you should just USEMALLOC then... In any case, to stay on the safe side, you TLS implementation should use malloc/free (and maybe then you could use such TLS to make U++ allocator work, although any positive effects will be likely diminished by slow TLS).
|
Ok, thanks for the advice.
Matthias
|
|
|
|
Re: GuiLock Example broken [message #22871 is a reply to message #22860] |
Mon, 24 August 2009 10:26   |
 |
koldo
Messages: 3432 Registered: August 2008
|
Senior Veteran |
|
|
Hello all
Good news. Twilight Dragon Media has released their GCC/mingw32 4.4.1 version (http://www.tdragon.net/recentgcc/)
I have just tried GUIMT and GUILock samples and both work.
Bad news. The samples seem to go slow. GUILock with MSC Debug goes much faster than with MinGW Speed.
The binaries I have chosen first are without dwarf-2.
Best regards
Koldo
Addendum 1:
Unfortunately there are compiling problems using dwarf-2 version
Compiling GUILock sample I get:Quote: | In file included from C:/upp/out/Draw/MINGW.Debug.Debug_full.Gui.Mt\$bl itz.cpp:3:
C:\upp\uppsrc\Draw\DrawLock.cpp:11: error: thread-local storage not supported for this target
In file included from C:/upp/out/Draw/MINGW.Debug.Debug_full.Gui.Mt\$bl itz. sGlokLevel > 0".cpp:10:
C:\upp\uppsrc\Draw\Font.cpp:266: error: thread-local storage not supported for this target
C:\upp\uppsrc\Draw\Font.cpp:328: error: thread-local storage not supported for this target
C:\upp\uppsrc\Draw\Font.cpp:355: error: thread-local storage not supported for this target
C:\upp\uppsrc\Draw\Font.cpp:356: error: thread-local storage not supported for this target
C:\upp\uppsrc\Draw\Font.cpp:357: error: thread-local storage not supported for this target
...
|
They are related with thread__.
Addendum 2:
This is black magic for me: In Mt.h using always
#define thread__ __declspec(thread) (removing __thread) GUIMT sample works well and GUILock stops with error "Assertion failed in ... DrawLock.cpp, line 32. sGLockLevel > 0"
Best regards
Iñaki
[Updated on: Mon, 24 August 2009 11:22] Report message to a moderator
|
|
|
|
|
Goto Forum:
Current Time: Tue Apr 29 05:47:02 CEST 2025
Total time taken to generate the page: 0.00866 seconds
|
|
|