www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 3885] New: No multithread support for Windows DLL

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3885

           Summary: No multithread support for Windows DLL
           Product: D
           Version: unspecified
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: druntime
        AssignedTo: sean invisibleduck.org
        ReportedBy: r.sagitario gmx.de


--- Comment #0 from Rainer Schuetze <r.sagitario gmx.de> 2010-03-06 08:16:32
PST ---
Created an attachment (id=583)
dll test project

There is currently no support for multithreading when creating DLLs. Here's a
small test project that creates a DLL and builds three programs:

test.exe: links against the import library of the DLL
testdyn.exe: loads the DLL via LoadLibrary
teststat.exe: links evreything without using DLLs (just for comparison).

The test program creates 10 threads (in the case of testdyn.exe 5 before
loading the library), and then calls a few functions mainly testing TLS access
and memory corruption.

This is for both D1 and D2, see the top of build.bat for DMD path and switching
versions.

Both test.exe and testdyn.exe produce access violations.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 06 2010
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3885



--- Comment #1 from Rainer Schuetze <r.sagitario gmx.de> 2010-03-06 08:31:23
PST ---
Created an attachment (id=584)
allow multithreading with dlls

Here's a patch that fixes the issue for D2. It consists of 3 parts:
1. some modifications to core.thread to allow attaching and detaching to
threads that are not the current thread.
2. a support file core.thread_helper to enumerate running threads, so that you
can attach to these in DllMain
3. another support file core.dll_helper to fix the missing implicite TLS
support on Windows XP.

After applying the patch to druntime, the test project can be compiled with
-version=use_patch to test it.

Sorry, don't know enough for the Posix version, so there might be some issues
to sort out.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 06 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3885



--- Comment #2 from Rainer Schuetze <r.sagitario gmx.de> 2010-03-06 08:35:50
PST ---
Created an attachment (id=585)
allow multithreading with dlls in D1

this is a similar patch for D1:

1. some adjustments to std.thread to attach and detach threads.
2. the same thread_helper file, but with different module name and import.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 06 2010
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3885


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com


--- Comment #3 from Walter Bright <bugzilla digitalmars.com> 2010-03-12
00:46:16 PST ---
I've got these integrated in to Phobos and checked in now. Everyone who needs
this, please give it a try!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 12 2010
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=3885


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |FIXED


--- Comment #4 from Don <clugdbug yahoo.com.au> 2010-04-09 19:12:47 PDT ---
Fixed DMD1.058 and DMD2.042.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Apr 09 2010