public inbox for
 help / color / mirror / Atom feed
From: Dmitry Sernii <>
Subject: Handle leak when using pthread mutex with win32 api threads
Date: Fri, 04 Mar 2005 15:53:00 -0000	[thread overview]
Message-ID: <> (raw)

Hello All!
I have handle leak, when using win32 api threads with pthread mutexes.
I'm using pthread-win32 2005-01-03 pthread snapshot.

Here is the sample application which reproduce the problem:

#include <pthread.h>
#include <windows.h>
#include <conio.h>

const int max_threads = 500;

DWORD WINAPI threadProc(void* param)
	static pthread_mutex_t mutex(PTHREAD_RECURSIVE_MUTEX_INITIALIZER);	
	return 0;

void main()
	DWORD id;
	HANDLE th[max_threads];
	int i;
	for (i=0;i<max_threads;i++)
	for (i=0;i<max_threads;i++)

after that if you take a look at Task Manager you can see lots of
handlers used by the program. If you replace win32 API threads with
pthreads everything works fine. Also this program works ok if you
change pthread mutexes with win32 mutexes.
The same problem happends when using QT threads (version 3.3.4
)instead of win32 api threads.

problem reproduces with MSVC 6.0 compiler.

Best Regards,
Dmitrii Sernii

             reply	other threads:[~2005-03-04 15:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-04 15:53 Dmitry Sernii [this message]
2005-03-04 17:06 ` Gottlob Frege
2005-03-04 22:27   ` Ross Johnson
2005-03-04 17:07 ` Gottlob Frege
2005-03-05 13:31 Dmitrii Sernii
2005-03-05 21:41 ` Ross Johnson
2005-03-08  1:22 ` Ross Johnson
2005-03-06  8:54 Dmitrii Sernii
2005-03-06 12:51 Bossom, John

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).