Warning: Can't synchronize with the repository (Unsupported version control system "svn": "/usr/lib/libsvn_client-1.so.0: undefined symbol: svn_mergeinfo__filter_catalog_by_ranges" ). Look in the Trac log for more information.

Ticket #84: [Portaudio] CreateThread vs. _beginthreadex in WMME.eml

File [Portaudio] CreateThread vs. _beginthreadex in WMME.eml, 4.4 KB (added by gordon_gidluck, 4 months ago)

original email from Bodo

Line 
1X-Account-Key: account2
2X-UIDL: <48B2EC31.2010603@sygyt.com>
3X-Mozilla-Status: 0011
4X-Mozilla-Status2: 00000000
5Return-Path: <bodo.maass@sygyt.com>
6Received: from ispmxaamta06-gx.windstream.net ([85.13.138.168])
7          by ispmxmta12-srv.windstream.net with ESMTP
8          id <20080825173038.WDZE8427.ispmxmta12-srv.windstream.net@ispmxaamta06-gx.windstream.net>
9          for <gidluck@alltel.net>; Mon, 25 Aug 2008 12:30:38 -0500
10Received: from dd18200.kasserver.com ([85.13.138.168])
11          by ispmxaamta06-gx.windstream.net with ESMTP
12          id <20080825173037.NQUO20036.ispmxaamta06-gx.windstream.net@dd18200.kasserver.com>
13          for <gidluck@alltel.net>; Mon, 25 Aug 2008 12:30:37 -0500
14Received: from [192.168.1.101] (host218-51-dynamic.5-87-r.retail.telecomitalia.it [87.5.51.218])
15        by dd18200.kasserver.com (Postfix) with ESMTP id 196B81819201B;
16        Mon, 25 Aug 2008 19:30:34 +0200 (CEST)
17Message-ID: <48B2EC31.2010603@sygyt.com>
18Date: Mon, 25 Aug 2008 19:30:25 +0200
19From: Bodo Maass <bodo.maass@sygyt.com>
20Organization: Sygyt Software
21User-Agent: Thunderbird 2.0.0.16 (Windows/20080708)
22MIME-Version: 1.0
23To: Gordon Gidluck <gidluck@alltel.net>, portaudio@techweb.rfa.org
24Subject: Re: [Portaudio] CreateThread vs. _beginthreadex in WMME
25References: <48AEBD7D.9030802@sygyt.com> <010501c90661$30e3a730$0b00a8c0@rossmacbook> <48B2CC36.7050108@alltel.net>
26In-Reply-To: <48B2CC36.7050108@alltel.net>
27Content-Type: text/plain; charset=ISO-8859-1; format=flowed
28Content-Transfer-Encoding: 7bit
29X-Cloudmark-Analysis: v=1.0 c=1 a=FzLEsc44_lMA:10 a=4ahWgtOr4jAA:10 a=k9yv4BZYgbxZf3bBnjXcVA==:17 a=yMhMjlubAAAA:8 a=BDktQ--kAAAA:8 a=0Wz6Fd-ORsKiX3WLP_gA:9 a=sKQ_6hjfOoFoJ_UJY8cA:7 a=zBKqr-RwKcVZFK4-uJO3COstrCAA:4 a=7RhDnMDjS-4A:10 a=50e4U0PicR4A:10
30
31Hi Gordon,
32
33_beginthreadex is a function from the runtime library, and CreateThread
34is from the Win32 API, so I wouldn't think that Microsoft could have
35fixed the issue.
36But I will create a simple test app to reproduce the memory leak
37mentioned, and then we can see if the problem still happens in VC 2005
38and 2008. I am travelling this week, so I'll post my results here
39sometime next week.
40
41  Bodo
42
43
44Gordon Gidluck schrieb:
45> Bodo and Ross,
46>
47> To me it does not make sense to change this unless it is still a
48> problem. Since the article is over three years old, perhaps Microsoft
49> has fixed this in Visual Studio 2005 and 2008. ???
50>
51> _beginthead is not supported in embedded Visual C++ 3 and 4 for native
52> code development, but it seems that _beginthread could be statically
53> linked from an older library.
54>
55> Gordon
56>
57> Ross Bencina wrote:
58>> Hi Bodo
59>>
60>> I've always wondered about this. I don't think it is deliberate, just
61>> a bad habit & ignorance of one of the developers (me).
62>>
63>> Are you experienced with the use of _beginthread/_beginthreadex ? Do
64>> you know if it is portable to all Win32/Win64 compilers?
65>>
66>> Ross.
67>>
68>>
69>>
70>>
71>> ----- Original Message ----- From: "Bodo Maass" <bodo.maass@sygyt.com>
72>> To: <Portaudio@techweb.rfa.org>
73>> Sent: Friday, August 22, 2008 11:22 PM
74>> Subject: [Portaudio] CreateThread vs. _beginthreadex in WMME
75>>
76>>
77>> 
78>>> Hi,
79>>>
80>>> I noticed that the processing thread that calls the user callback in
81>>> wmme is created with the CreateThread function instead of the
82>>> recommended _beginthread or _beginthreadex.
83>>>
84>>> The beginthread methods set up the runtime library for that thread and
85>>> then call CreateThread internally. Failure to do that may lead to a
86>>> small memory leak when the thread finishes:
87>>> http://support.microsoft.com/default.aspx/kb/104641
88>>>
89>>> Now, in portaudio, the processing thread calls a user defined callback
90>>> function, which may well call some functions of the runtime library
91>>> (it's hard not to), and this may cause the memory leak mentioned in the
92>>> MS article.
93>>>
94>>> Is the use of CreateThread at this place deliberate? If not, I would
95>>> recommend changing it to _beginthreadex.
96>>>
97>>> Best wishes,
98>>>  Bodo
99>>>
100>>>
101>>> _______________________________________________
102>>> Portaudio mailing list
103>>> Portaudio@techweb.rfa.org
104>>> http://techweb.rfa.org/mailman/listinfo/portaudio
105>>>
106>>>     
107>>
108>> _______________________________________________
109>> Portaudio mailing list
110>> Portaudio@techweb.rfa.org
111>> http://techweb.rfa.org/mailman/listinfo/portaudio
112>>
113>>   
114>
115