5237 OSThreadWaitState osts(thread->osthread(), false /* not Object.wait() */);
5238 thread->set_suspend_equivalent();
5239
5240 WaitForSingleObject(_ParkEvent, time);
5241 ResetEvent(_ParkEvent);
5242
5243 // If externally suspended while waiting, re-suspend
5244 if (thread->handle_special_suspend_equivalent_condition()) {
5245 thread->java_suspend_self();
5246 }
5247 }
5248 }
5249
5250 void Parker::unpark() {
5251 guarantee(_ParkEvent != NULL, "invariant");
5252 SetEvent(_ParkEvent);
5253 }
5254
5255 // Run the specified command in a separate process. Return its exit value,
5256 // or -1 on failure (e.g. can't create a new process).
5257 int os::fork_and_exec(char* cmd) {
5258 STARTUPINFO si;
5259 PROCESS_INFORMATION pi;
5260 DWORD exit_code;
5261
5262 char * cmd_string;
5263 char * cmd_prefix = "cmd /C ";
5264 size_t len = strlen(cmd) + strlen(cmd_prefix) + 1;
5265 cmd_string = NEW_C_HEAP_ARRAY_RETURN_NULL(char, len, mtInternal);
5266 if (cmd_string == NULL) {
5267 return -1;
5268 }
5269 cmd_string[0] = '\0';
5270 strcat(cmd_string, cmd_prefix);
5271 strcat(cmd_string, cmd);
5272
5273 // now replace all '\n' with '&'
5274 char * substring = cmd_string;
5275 while ((substring = strchr(substring, '\n')) != NULL) {
5276 substring[0] = '&';
5277 substring++;
|
5237 OSThreadWaitState osts(thread->osthread(), false /* not Object.wait() */);
5238 thread->set_suspend_equivalent();
5239
5240 WaitForSingleObject(_ParkEvent, time);
5241 ResetEvent(_ParkEvent);
5242
5243 // If externally suspended while waiting, re-suspend
5244 if (thread->handle_special_suspend_equivalent_condition()) {
5245 thread->java_suspend_self();
5246 }
5247 }
5248 }
5249
5250 void Parker::unpark() {
5251 guarantee(_ParkEvent != NULL, "invariant");
5252 SetEvent(_ParkEvent);
5253 }
5254
5255 // Run the specified command in a separate process. Return its exit value,
5256 // or -1 on failure (e.g. can't create a new process).
5257 int os::fork_and_exec(char* cmd, bool use_vfork_if_available) {
5258 STARTUPINFO si;
5259 PROCESS_INFORMATION pi;
5260 DWORD exit_code;
5261
5262 char * cmd_string;
5263 char * cmd_prefix = "cmd /C ";
5264 size_t len = strlen(cmd) + strlen(cmd_prefix) + 1;
5265 cmd_string = NEW_C_HEAP_ARRAY_RETURN_NULL(char, len, mtInternal);
5266 if (cmd_string == NULL) {
5267 return -1;
5268 }
5269 cmd_string[0] = '\0';
5270 strcat(cmd_string, cmd_prefix);
5271 strcat(cmd_string, cmd);
5272
5273 // now replace all '\n' with '&'
5274 char * substring = cmd_string;
5275 while ((substring = strchr(substring, '\n')) != NULL) {
5276 substring[0] = '&';
5277 substring++;
|