开发者

On Windows, spawnl returning EINVAL

开发者 https://www.devze.com 2023-02-09 02:24 出处:网络
I\'m using _spawnl from process.h on Windows.I\'m seeing something very strange.I want to spawn N processes.The code I have works fine until N>=12.

I'm using _spawnl from process.h on Windows. I'm seeing something very strange. I want to spawn N processes. The code I have works fine until N>=12.

When N>=12, suddenly the spawnl call returns -1 and errno is EINVAL?! (invalid mode) The mode argument doesn't change between calls and neither does the exe name. A few of the arguments do change in very minor ways but those are the only differences between the calls.

Now I'm aware of this question which looks similar. But in his case, he had quotes in his path that spawnl didn't like. In my case, it can't be the exe name. The Microsoft documentation that I've been able to find says that EINVAL means that mode is invalid which can't be true in my case because the mode is the same for the first 11.

If anybody knows the ins and outs of spawnl on Windows and knows of any other reasons it might result in an EINVAL, I'm all ears. I've Googled endlessly on this, but came up empty handed.

Another interesting data point. I'm running Windows XP, 32-bit running under VM-Ware. My coworker has two Windows machines (both XP, one 32-bit and one 64-bit). H开发者_Go百科e doesn't see this issue. He case spawn 32 processes without an issue.


You should use CreateProcess():

http://msdn.microsoft.com/en-us/library/ms682425%28VS.85%29.aspx

If you have trouble with it, please ask.

0

精彩评论

暂无评论...
验证码 换一张
取 消