ホーム › Networking.HttpServer › HttpShutdownRequestQueue
HttpShutdownRequestQueue
関数リクエストキューをシャットダウンし処理を停止する。
シグネチャ
// HTTPAPI.dll
#include <windows.h>
DWORD HttpShutdownRequestQueue(
HANDLE RequestQueueHandle
);パラメーター
| 名前 | 型 | 方向 | 説明 |
|---|---|---|---|
| RequestQueueHandle | HANDLE | in | シャットダウンするリクエストキューのハンドル。リクエストキューは HttpCreateRequestQueue 関数の呼び出しによって作成され、そのハンドルが返されます。 |
戻り値の型: DWORD
公式ドキュメント
指定したリクエストキュープロセスへのリクエストのキューイングを停止します。
戻り値
関数が成功した場合は NO_ERROR を返します。
関数が失敗した場合は、以下のいずれかのエラーコードを返します。
| 値 | 意味 |
|---|---|
|
ReqQueueHandle パラメーターが有効なリクエストキューを含んでいません。
アプリケーションにリクエストキューをシャットダウンする権限がありません。 |
解説(Remarks)
HttpShutdownRequestQueue は未処理のリクエストをキャンセルし、リクエストキュープロセス上のすべての処理を停止します。この関数が呼び出されると、以下の手順が実行されます。
- リクエストキュープロセスがクリーンアップ対象としてマークされ、新しいリクエストはリクエストキュープロセスにルーティングされなくなります。
- 呼び出し元プロセスがコントローラーである場合、未処理の HttpWaitForDemandStart 呼び出しがキャンセルされます。
- 呼び出し元プロセスからの保留中の HttpReceiveHttpRequest 呼び出しがキャンセルされます。
- すでに呼び出し元プロセスにバインドされているリクエストがキャンセルされます。
- リクエストキュープロセスにキューイングされている未受信の保留中リクエストは、別のリクエストキュープロセスに再ルーティングされます。他に利用可能なリクエストキュープロセスがない場合、保留中のリクエストはリクエストキューが閉じられるか、別の非コントローラーのリクエストキュープロセスが起動するまで保存されます。
- 呼び出し元プロセスによって開始された保留中の HttpWaitForDisconnect 呼び出しがキャンセルされます。
- 呼び出し元プロセスによって示された未処理のレスポンスは影響を受けず、正常に完了します。
リクエストキューハンドルが複数のプロセスで共有されている場合、HttpShutdownRequestQueue はクリーンアップを呼び出し元プロセスに限定する点に注意してください。現在そのリクエストキュー上で動作している他のプロセスは影響を受けません。
HttpShutdownRequestQueue は、アプリケーションがリクエストキュープロセスをリサイクルするために使用できます。この目的では、リクエストキューを他のプロセスと共有しているプロセスを終了する前に HttpShutdownRequestQueue を呼び出します。HttpShutdownRequestQueue が戻った後、そのプロセスは安全に終了またはリサイクルできます。
出典・ライセンス: 上記「公式ドキュメント」の内容は Microsoft の Win32 API ドキュメント(MicrosoftDocs/sdk-api)を日本語に翻訳・改変したものです。© Microsoft Corporation. CC BY 4.0 で提供。
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
Microsoft 公式リファレンス: 英語 (en-us) · 日本語 (ja-jp) · 原文ソース (GitHub)
各言語での呼び出し定義
// HTTPAPI.dll
#include <windows.h>
DWORD HttpShutdownRequestQueue(
HANDLE RequestQueueHandle
);[DllImport("HTTPAPI.dll", ExactSpelling = true)]
static extern uint HttpShutdownRequestQueue(
IntPtr RequestQueueHandle // HANDLE
);<DllImport("HTTPAPI.dll", ExactSpelling:=True)>
Public Shared Function HttpShutdownRequestQueue(
RequestQueueHandle As IntPtr ' HANDLE
) As UInteger
End Function' RequestQueueHandle : HANDLE
Declare PtrSafe Function HttpShutdownRequestQueue Lib "httpapi" ( _
ByVal RequestQueueHandle As LongPtr) As Long
' VBA7前提(PtrSafe)。32bit Office では LongPtr→Long。Integer=16bit / Long=32bit / LongLong=64bit。import ctypes
from ctypes import wintypes
HttpShutdownRequestQueue = ctypes.windll.httpapi.HttpShutdownRequestQueue
HttpShutdownRequestQueue.restype = wintypes.DWORD
HttpShutdownRequestQueue.argtypes = [
wintypes.HANDLE, # RequestQueueHandle : HANDLE
]require 'fiddle'
require 'fiddle/import'
lib = Fiddle.dlopen('HTTPAPI.dll')
HttpShutdownRequestQueue = Fiddle::Function.new(
lib['HttpShutdownRequestQueue'],
[
Fiddle::TYPE_VOIDP, # RequestQueueHandle : HANDLE
],
-Fiddle::TYPE_INT)#[link(name = "httpapi")]
extern "system" {
fn HttpShutdownRequestQueue(
RequestQueueHandle: *mut core::ffi::c_void // HANDLE
) -> u32;
}
// crates: windows-sys provides ready-made bindings for this API.$sig = @"
[DllImport("HTTPAPI.dll")]
public static extern uint HttpShutdownRequestQueue(IntPtr RequestQueueHandle);
"@
$api = Add-Type -MemberDefinition $sig -Name 'HTTPAPI_HttpShutdownRequestQueue' -Namespace Win32 -PassThru
# $api::HttpShutdownRequestQueue(RequestQueueHandle)#uselib "HTTPAPI.dll"
#func global HttpShutdownRequestQueue "HttpShutdownRequestQueue" sptr
; HttpShutdownRequestQueue RequestQueueHandle ; 戻り値は stat
; RequestQueueHandle : HANDLE -> "sptr"
; ※HSP3.7は #func のため戻り値はシステム変数 stat に格納されます。#uselib "HTTPAPI.dll"
#cfunc global HttpShutdownRequestQueue "HttpShutdownRequestQueue" sptr
; res = HttpShutdownRequestQueue(RequestQueueHandle)
; RequestQueueHandle : HANDLE -> "sptr"; DWORD HttpShutdownRequestQueue(HANDLE RequestQueueHandle)
#uselib "HTTPAPI.dll"
#cfunc global HttpShutdownRequestQueue "HttpShutdownRequestQueue" intptr
; res = HttpShutdownRequestQueue(RequestQueueHandle)
; RequestQueueHandle : HANDLE -> "intptr"import (
"golang.org/x/sys/windows"
"unsafe"
)
var (
httpapi = windows.NewLazySystemDLL("HTTPAPI.dll")
procHttpShutdownRequestQueue = httpapi.NewProc("HttpShutdownRequestQueue")
)
// RequestQueueHandle (HANDLE)
r1, _, err := procHttpShutdownRequestQueue.Call(
uintptr(RequestQueueHandle),
)
_ = err // syscall.Errno (valid when the call sets last-error)
_ = r1 // DWORDfunction HttpShutdownRequestQueue(
RequestQueueHandle: THandle // HANDLE
): DWORD; stdcall;
external 'HTTPAPI.dll' name 'HttpShutdownRequestQueue';result := DllCall("HTTPAPI\HttpShutdownRequestQueue"
, "Ptr", RequestQueueHandle ; HANDLE
, "UInt") ; return: DWORD●HttpShutdownRequestQueue(RequestQueueHandle) = DLL("HTTPAPI.dll", "dword HttpShutdownRequestQueue(void*)")
# 呼び出し: HttpShutdownRequestQueue(RequestQueueHandle)
# RequestQueueHandle : HANDLE -> "void*"
# なでしこ1は32bit・ANSI(Shift_JIS)。文字列=char*(ANSI)、ポインタ/ハンドル=void*(4byte)。const std = @import("std");
extern "httpapi" fn HttpShutdownRequestQueue(
RequestQueueHandle: ?*anyopaque // HANDLE
) callconv(std.os.windows.WINAPI) u32;proc HttpShutdownRequestQueue(
RequestQueueHandle: pointer # HANDLE
): uint32 {.importc: "HttpShutdownRequestQueue", stdcall, dynlib: "HTTPAPI.dll".}pragma(lib, "httpapi");
extern(Windows)
uint HttpShutdownRequestQueue(
void* RequestQueueHandle // HANDLE
);ccall((:HttpShutdownRequestQueue, "HTTPAPI.dll"), stdcall, UInt32,
(Ptr{Cvoid},),
RequestQueueHandle)
# RequestQueueHandle : HANDLE -> Ptr{Cvoid}
# stdcall は 32bit のみ意味を持つ(x64 では無視)。local ffi = require("ffi")
ffi.cdef[[
uint32_t HttpShutdownRequestQueue(
void* RequestQueueHandle);
]]
local httpapi = ffi.load("httpapi")
-- httpapi.HttpShutdownRequestQueue(RequestQueueHandle)
-- RequestQueueHandle : HANDLE
-- 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。const koffi = require('koffi');
const lib = koffi.load('HTTPAPI.dll');
const HttpShutdownRequestQueue = lib.func('__stdcall', 'HttpShutdownRequestQueue', 'uint32_t', ['void *']);
// HttpShutdownRequestQueue(RequestQueueHandle)
// RequestQueueHandle : HANDLE -> 'void *'
// 出力ポインタは koffi.out(...) で包む。構造体は koffi.struct で定義。const lib = Deno.dlopen("HTTPAPI.dll", {
HttpShutdownRequestQueue: { parameters: ["pointer"], result: "u32" },
});
// lib.symbols.HttpShutdownRequestQueue(RequestQueueHandle)
// RequestQueueHandle : HANDLE -> "pointer"
// 文字列引数は "buffer"(NUL 終端のバイト列を Uint8Array で渡す)。
// 値渡し構造体は { struct: [ ...field types... ] } を使用。<?php
$ffi = FFI::cdef(<<<C
uint32_t HttpShutdownRequestQueue(
void* RequestQueueHandle);
C, "HTTPAPI.dll");
// $ffi->HttpShutdownRequestQueue(RequestQueueHandle);
// RequestQueueHandle : HANDLE
// 構造体/GUIDへのポインタは cdef が通るよう void* で表記(実型は各引数コメント参照)。値渡し構造体・enum は対応する typedef を cdef に追加すること。
// WINAPI(stdcall): x64 では呼出規約が統一されるため問題なし。x86 では __stdcall 対応のラッパが必要な場合あり。import com.sun.jna.*;
import com.sun.jna.ptr.*;
import com.sun.jna.win32.StdCallLibrary;
import com.sun.jna.win32.W32APIOptions;
public interface Httpapi extends StdCallLibrary {
Httpapi INSTANCE = Native.load("httpapi", Httpapi.class);
int HttpShutdownRequestQueue(
Pointer RequestQueueHandle // HANDLE
);
}@[Link("httpapi")]
lib LibHTTPAPI
fun HttpShutdownRequestQueue = HttpShutdownRequestQueue(
RequestQueueHandle : Void* # HANDLE
) : UInt32
end
# 構造体/GUID/enum は lib 内に対応する型定義が必要。
# 呼出規約: x64 は規約統一のため OK。x86(32bit)は WINAPI=stdcall だが Crystal の fun に stdcall 付与構文がなく非対応。import 'dart:ffi';
import 'package:ffi/ffi.dart';
typedef HttpShutdownRequestQueueNative = Uint32 Function(Pointer<Void>);
typedef HttpShutdownRequestQueueDart = int Function(Pointer<Void>);
final HttpShutdownRequestQueue = DynamicLibrary.open('HTTPAPI.dll')
.lookupFunction<HttpShutdownRequestQueueNative, HttpShutdownRequestQueueDart>('HttpShutdownRequestQueue');
// RequestQueueHandle : HANDLE -> Pointer<Void>
// 文字列は package:ffi の "...".toNativeUtf16()/toNativeUtf8() で変換。{$mode objfpc}{$H+}
function HttpShutdownRequestQueue(
RequestQueueHandle: THandle // HANDLE
): DWORD; stdcall;
external 'HTTPAPI.dll' name 'HttpShutdownRequestQueue';import Foreign
import Foreign.C.Types
import Foreign.C.String
foreign import stdcall safe "HttpShutdownRequestQueue"
c_HttpShutdownRequestQueue :: Ptr () -> IO Word32
-- RequestQueueHandle : HANDLE -> Ptr ()
-- 要 GHC(Windows)。stdcall は x64 では ccall として扱われる。ブロックする API は safe 呼び出し推奨。open Ctypes
open Foreign
let httpshutdownrequestqueue =
foreign "HttpShutdownRequestQueue"
((ptr void) @-> returning uint32_t)
(* RequestQueueHandle : HANDLE -> (ptr void) *)
(* foreign は cdecl 前提。x64 Windows では WINAPI と一致。構造体は ctypes structure を定義のこと。 *)(cffi:define-foreign-library httpapi (t "HTTPAPI.dll"))
(cffi:use-foreign-library httpapi)
(cffi:defcfun ("HttpShutdownRequestQueue" http-shutdown-request-queue :convention :stdcall) :uint32
(request-queue-handle :pointer)) ; HANDLE
; isize/usize(INT_PTR/SIZE_T)は x64 前提で :int64/:uint64。x86 では :int32/:uint32。use Win32::API;
my $HttpShutdownRequestQueue = Win32::API::More->new('HTTPAPI',
'DWORD HttpShutdownRequestQueue(HANDLE RequestQueueHandle)');
# my $ret = $HttpShutdownRequestQueue->Call($RequestQueueHandle);
# RequestQueueHandle : HANDLE -> HANDLE
# 値渡し構造体は pack() した文字列、または Win32::API::Struct を使用。関連項目
公式の関連項目
- f HttpCloseRequestQueue — HTTPリクエストキューのハンドルを閉じる。
- f HttpCreateRequestQueue — 名前付きのHTTPリクエストキューを作成する。
- f HttpQueryRequestQueueProperty — リクエストキューのプロパティを取得する。
- f HttpSetRequestQueueProperty — リクエストキューのプロパティを設定する。