Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

very funny ...WaitForMultipleObject failed

66 views
Skip to first unread message

Henry Zhang

unread,
May 14, 2002, 2:26:19 PM5/14/02
to
I have a test program which starts a number of applications. When I start
50 of them, it is still fine. However, when i start 100 processes of this
application, I got
a error "Invalid Parameter" (87) from WaitForMultipleObjects.

I double checked on the CreateThread calls, they all succeeded before I
call this "WaitForMultipleObjects"

donno why this will happen... I will greatly appreciated if someone will
shed me some light!


Pete Becker

unread,
May 14, 2002, 2:36:16 PM5/14/02
to

Between 50 and 100 there's a magic number: 64. Check the value of
MAXIMUM_WAIT_OBJECTS.

--
Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.com)

Arnold Hendriks

unread,
May 14, 2002, 2:39:08 PM5/14/02
to
Henry Zhang <hzh...@saflink.com> wrote:
> I have a test program which starts a number of applications. When I start
> 50 of them, it is still fine. However, when i start 100 processes of this
> application, I got
> a error "Invalid Parameter" (87) from WaitForMultipleObjects.

> I double checked on the CreateThread calls, they all succeeded before I
> call this "WaitForMultipleObjects"

Are you talking about processes or threads? Anyway, WaitForMultipleObjects
has an arbitrary limit on the objects it can wait on, MAXIMUM_WAIT_OBJECTS,
which is 64 in my header files.

If you're using threads, have threads signal their imminent finish themselves
through shared data so you only need a single object. If you're using
processes, you may be out of luck for a clean solution - you could try two
threads doing a WaitForMultipleObjects, and have them split the load.

Maybe win32-specific newsgroups know better solutions to avoiding the
64 limit.

--
Arnold Hendriks <a.hen...@b-lex.com>
B-Lex Information Technologies, http://www.b-lex.com/

Andy Moreton

unread,
May 16, 2002, 5:10:05 AM5/16/02
to
hzh...@saflink.com (Henry Zhang) wrote in <fFcE8.15279$bV3.658502
@news0.telusplanet.net>:

If you read the SDK docs, you would note that WaitForMultipleObjects() can
only wait on MAX_WAIT_OBJECTS waitable objects.

AndyM

--
GlobespanVirata, Unit 230 Science Park, Milton Road, Cambridge CB4 0WB, UK
http://www.globespanvirata.com/ Tel: +44 1223 707400 Fax: +44 1223 707447

0 new messages