ホーム › System.Threading › SetThreadpoolThreadMinimum
SetThreadpoolThreadMinimum
関数スレッドプールの最小スレッド数を設定する。
シグネチャ
// KERNEL32.dll
#include <windows.h>
BOOL SetThreadpoolThreadMinimum(
PTP_POOL ptpp,
DWORD cthrdMic
);パラメーター
| 名前 | 型 | 方向 |
|---|---|---|
| ptpp | PTP_POOL | in |
| cthrdMic | DWORD | in |
戻り値の型: BOOL
各言語での呼び出し定義
// KERNEL32.dll
#include <windows.h>
BOOL SetThreadpoolThreadMinimum(
PTP_POOL ptpp,
DWORD cthrdMic
);[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool SetThreadpoolThreadMinimum(
IntPtr ptpp, // PTP_POOL
uint cthrdMic // DWORD
);<DllImport("KERNEL32.dll", SetLastError:=True, ExactSpelling:=True)>
Public Shared Function SetThreadpoolThreadMinimum(
ptpp As IntPtr, ' PTP_POOL
cthrdMic As UInteger ' DWORD
) As Boolean
End Function' ptpp : PTP_POOL
' cthrdMic : DWORD
Declare PtrSafe Function SetThreadpoolThreadMinimum Lib "kernel32" ( _
ByVal ptpp As LongPtr, _
ByVal cthrdMic As Long) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
SetThreadpoolThreadMinimum = ctypes.windll.kernel32.SetThreadpoolThreadMinimum
SetThreadpoolThreadMinimum.restype = wintypes.BOOL
SetThreadpoolThreadMinimum.argtypes = [
ctypes.c_ssize_t, # ptpp : PTP_POOL
wintypes.DWORD, # cthrdMic : DWORD
]
# GetLastError: use ctypes.GetLastError() (or ctypes.WinDLL(use_last_error=True))require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('KERNEL32.dll')
SetThreadpoolThreadMinimum = Fiddle::Function.new(
lib['SetThreadpoolThreadMinimum'],
[
Fiddle::TYPE_INTPTR_T, # ptpp : PTP_POOL
-Fiddle::TYPE_INT, # cthrdMic : DWORD
],
Fiddle::TYPE_INT)#[link(name = "kernel32")]
extern "system" {
fn SetThreadpoolThreadMinimum(
ptpp: isize, // PTP_POOL
cthrdMic: u32 // DWORD
) -> i32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[return: MarshalAs(UnmanagedType.Bool)]
[DllImport("KERNEL32.dll", SetLastError = true)]
public static extern bool SetThreadpoolThreadMinimum(IntPtr ptpp, uint cthrdMic);
"@
$api = Add-Type -MemberDefinition $sig -Name 'KERNEL32_SetThreadpoolThreadMinimum' -Namespace Win32 -PassThru
# $api::SetThreadpoolThreadMinimum(ptpp, cthrdMic)#uselib "KERNEL32.dll"
#func global SetThreadpoolThreadMinimum "SetThreadpoolThreadMinimum" sptr, sptr
; SetThreadpoolThreadMinimum ptpp, cthrdMic ; 戻り値は stat
; ptpp : PTP_POOL -> "sptr"
; cthrdMic : DWORD -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "KERNEL32.dll"
#cfunc global SetThreadpoolThreadMinimum "SetThreadpoolThreadMinimum" sptr, int
; res = SetThreadpoolThreadMinimum(ptpp, cthrdMic)
; ptpp : PTP_POOL -> "sptr"
; cthrdMic : DWORD -> "int"; BOOL SetThreadpoolThreadMinimum(PTP_POOL ptpp, DWORD cthrdMic)
#uselib "KERNEL32.dll"
#cfunc global SetThreadpoolThreadMinimum "SetThreadpoolThreadMinimum" intptr, int
; res = SetThreadpoolThreadMinimum(ptpp, cthrdMic)
; ptpp : PTP_POOL -> "intptr"
; cthrdMic : DWORD -> "int"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
kernel32 = windows.NewLazySystemDLL("KERNEL32.dll")
procSetThreadpoolThreadMinimum = kernel32.NewProc("SetThreadpoolThreadMinimum")
)
// ptpp (PTP_POOL), cthrdMic (DWORD)
r1, _, err := procSetThreadpoolThreadMinimum.Call(
uintptr(ptpp),
uintptr(cthrdMic),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // BOOLfunction SetThreadpoolThreadMinimum(
ptpp: NativeInt; // PTP_POOL
cthrdMic: DWORD // DWORD
): BOOL; stdcall;
external 'KERNEL32.dll' name 'SetThreadpoolThreadMinimum';result := DllCall("KERNEL32\SetThreadpoolThreadMinimum"
, "Ptr", ptpp ; PTP_POOL
, "UInt", cthrdMic ; DWORD
, "Int") ; return: BOOL●SetThreadpoolThreadMinimum(ptpp, cthrdMic) = DLL("KERNEL32.dll", "bool SetThreadpoolThreadMinimum(int, dword)")
# 呼び出し: SetThreadpoolThreadMinimum(ptpp, cthrdMic)
# ptpp : PTP_POOL -> "int"
# cthrdMic : DWORD -> "dword"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。