You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 6146 Reporter: Bardou Assigned to:@alainfrisch Status: closed (set by @xavierleroy on 2015-12-11T18:24:01Z) Resolution: fixed Priority: normal Severity: feature Platform: Windows Target version: 4.02.0+dev Category: otherlibs
Bug description
I implemented terminate_process like this:
#include <windows.h>
CAMLprim value o_terminate_process(value o_pid)
{
CAMLparam1(o_pid);
CAMLlocal1(o_result);
// The implementation of Unix.create_process returns the Handle as PID.
// Luckily this is exactly what we need.
HANDLE pid = (HANDLE) Long_val(o_pid);
BOOL result = TerminateProcess(pid, 0);
o_result = Val_bool(result);
CAMLreturn(o_result);
}
external terminate_process: int -> bool = "o_terminate_process"
I figured I might as well share the code. This could be used either to implement Unix.kill at least for signal SIGKILL. Or, a new function terminate_process could be provided. Just like create_process exists to simulate the Windows function CreateProcess using the Unix function fork, the terminate_process would exist to simulate the Windows function TerminateProcess using the Unix function kill.
The text was updated successfully, but these errors were encountered:
LexiFi's version has implemented exactly that (implementing partially Unix.kill for Sys.sigkill). Unless someone argues in favor of a dedicated terminate_process function, I'll commit a version of the "Unix.kill" proposal.
Original bug ID: 6146
Reporter: Bardou
Assigned to: @alainfrisch
Status: closed (set by @xavierleroy on 2015-12-11T18:24:01Z)
Resolution: fixed
Priority: normal
Severity: feature
Platform: Windows
Target version: 4.02.0+dev
Category: otherlibs
Bug description
I implemented terminate_process like this:
#include <windows.h>
CAMLprim value o_terminate_process(value o_pid)
{
CAMLparam1(o_pid);
CAMLlocal1(o_result);
// The implementation of Unix.create_process returns the Handle as PID.
// Luckily this is exactly what we need.
HANDLE pid = (HANDLE) Long_val(o_pid);
BOOL result = TerminateProcess(pid, 0);
o_result = Val_bool(result);
CAMLreturn(o_result);
}
external terminate_process: int -> bool = "o_terminate_process"
I figured I might as well share the code. This could be used either to implement Unix.kill at least for signal SIGKILL. Or, a new function terminate_process could be provided. Just like create_process exists to simulate the Windows function CreateProcess using the Unix function fork, the terminate_process would exist to simulate the Windows function TerminateProcess using the Unix function kill.
The text was updated successfully, but these errors were encountered: