VirtualBox

source: vbox/trunk/include/iprt/req.h@ 62485

Last change on this file since 62485 was 62473, checked in by vboxsync, 8 years ago

(C) 2016

  • Property eol-style set to native
  • Property svn:eol-style set to native
File size: 23.8 KB
Line 
1/** @file
2 * IPRT - Request Queue & Pool.
3 */
4
5/*
6 * Copyright (C) 2006-2016 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef ___iprt_req_h
27#define ___iprt_req_h
28
29#include <iprt/cdefs.h>
30#include <iprt/types.h>
31
32#include <iprt/stdarg.h>
33
34RT_C_DECLS_BEGIN
35
36/** @defgroup grp_rt_req RTReq - Request Queue & Pool.
37 * @ingroup grp_rt
38 * @{
39 */
40
41/** Request queue handle. */
42typedef struct RTREQQUEUEINT *RTREQQUEUE;
43/** Pointer to a request queue handle. */
44typedef RTREQQUEUE *PRTREQQUEUE;
45/** NIL request queue handle. */
46#define NIL_RTREQQUEUE ((RTREQQUEUE)0)
47
48/** Request thread pool handle. */
49typedef struct RTREQPOOLINT *RTREQPOOL;
50/** Poiner to a request thread pool handle. */
51typedef RTREQPOOL *PRTREQPOOL;
52/** NIL request pool handle. */
53#define NIL_RTREQPOOL ((RTREQPOOL)0)
54
55
56/**
57 * Request type.
58 */
59typedef enum RTREQTYPE
60{
61 /** Invalid request. */
62 RTREQTYPE_INVALID = 0,
63 /** RT: Internal. */
64 RTREQTYPE_INTERNAL,
65 /** Maximum request type (exclusive). Used for validation. */
66 RTREQTYPE_MAX
67} RTREQTYPE;
68
69/**
70 * Request flags.
71 */
72typedef enum RTREQFLAGS
73{
74 /** The request returns a iprt status code. */
75 RTREQFLAGS_IPRT_STATUS = 0,
76 /** The request is a void request and have no status code. */
77 RTREQFLAGS_VOID = 1,
78 /** Return type mask. */
79 RTREQFLAGS_RETURN_MASK = 1,
80 /** Caller does not wait on the packet, Queue process thread will free it. */
81 RTREQFLAGS_NO_WAIT = 2
82} RTREQFLAGS;
83
84
85/** A request packet. */
86typedef struct RTREQ RTREQ;
87/** Pointer to an RT request packet. */
88typedef RTREQ *PRTREQ;
89/** Nil request handle. */
90#define NIL_RTREQ ((PRTREQ)0)
91
92
93#ifdef IN_RING3
94
95/**
96 * Create a request packet queue
97 *
98 * @returns iprt status code.
99 * @param phQueue Where to store the request queue handle.
100 */
101RTDECL(int) RTReqQueueCreate(PRTREQQUEUE phQueue);
102
103/**
104 * Destroy a request packet queue
105 *
106 * @returns iprt status code.
107 * @param hQueue The request queue.
108 */
109RTDECL(int) RTReqQueueDestroy(RTREQQUEUE hQueue);
110
111/**
112 * Process one or more request packets
113 *
114 * @returns iprt status code. Any non-VINF_SUCCESS returns from request
115 * processing is immediately propagated to the caller.
116 * @retval VERR_TIMEOUT if @a cMillies was reached without the packet being
117 * added.
118 * @retval VERR_INVALID_HANDLE if @a hQueue not a valid queue handle.
119 *
120 * @param hQueue The request queue.
121 * @param cMillies Max number of milliseconds to wait for a pending
122 * request. This is not adjusted down before another
123 * wait, so the function may end up waiting for much
124 * longer than the given amount if there are requests
125 * trickling in at a rate slightly higher than the
126 * timeout.
127 *
128 * Use RT_INDEFINITE_WAIT to process requests until a
129 * non-VINF_SUCCESS return code is encountered.
130 *
131 * @remarks The function may repeatedly try wait for @a cMillies on new
132 * requests if requests arrive before it times out.
133 */
134RTDECL(int) RTReqQueueProcess(RTREQQUEUE hQueue, RTMSINTERVAL cMillies);
135
136/**
137 * Allocate and queue a call request.
138 *
139 * If it's desired to poll on the completion of the request set cMillies
140 * to 0 and use RTReqWait() to check for completion. In the other case
141 * use RT_INDEFINITE_WAIT.
142 * The returned request packet must be freed using RTReqRelease().
143 *
144 * @returns iprt statuscode.
145 * Will not return VERR_INTERRUPTED.
146 * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.
147 *
148 * @param hQueue The request queue.
149 * @param ppReq Where to store the pointer to the request.
150 * This will be NULL or a valid request pointer not matter what happens.
151 * @param cMillies Number of milliseconds to wait for the request to
152 * be completed. Use RT_INDEFINITE_WAIT to only
153 * wait till it's completed.
154 * @param pfnFunction Pointer to the function to call.
155 * @param cArgs Number of arguments following in the ellipsis.
156 * @param ... Function arguments.
157 *
158 * @remarks See remarks on RTReqQueueCallV.
159 */
160RTDECL(int) RTReqQueueCall(RTREQQUEUE hQueue, PRTREQ *ppReq, RTMSINTERVAL cMillies, PFNRT pfnFunction, unsigned cArgs, ...);
161
162/**
163 * Allocate and queue a call request to a void function.
164 *
165 * If it's desired to poll on the completion of the request set cMillies
166 * to 0 and use RTReqWait() to check for completion. In the other case
167 * use RT_INDEFINITE_WAIT.
168 * The returned request packet must be freed using RTReqRelease().
169 *
170 * @returns iprt status code.
171 * Will not return VERR_INTERRUPTED.
172 * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.
173 *
174 * @param hQueue The request queue.
175 * @param ppReq Where to store the pointer to the request.
176 * This will be NULL or a valid request pointer not matter what happens.
177 * @param cMillies Number of milliseconds to wait for the request to
178 * be completed. Use RT_INDEFINITE_WAIT to only
179 * wait till it's completed.
180 * @param pfnFunction Pointer to the function to call.
181 * @param cArgs Number of arguments following in the ellipsis.
182 * @param ... Function arguments.
183 *
184 * @remarks See remarks on RTReqQueueCallV.
185 */
186RTDECL(int) RTReqQueueCallVoid(RTREQQUEUE hQueue, PRTREQ *ppReq, RTMSINTERVAL cMillies, PFNRT pfnFunction, unsigned cArgs, ...);
187
188/**
189 * Allocate and queue a call request to a void function.
190 *
191 * If it's desired to poll on the completion of the request set cMillies
192 * to 0 and use RTReqWait() to check for completion. In the other case
193 * use RT_INDEFINITE_WAIT.
194 * The returned request packet must be freed using RTReqRelease().
195 *
196 * @returns iprt status code.
197 * Will not return VERR_INTERRUPTED.
198 * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.
199 *
200 * @param hQueue The request queue.
201 * @param ppReq Where to store the pointer to the request.
202 * This will be NULL or a valid request pointer not matter what happens, unless fFlags
203 * contains RTREQFLAGS_NO_WAIT when it will be optional and always NULL.
204 * @param cMillies Number of milliseconds to wait for the request to
205 * be completed. Use RT_INDEFINITE_WAIT to only
206 * wait till it's completed.
207 * @param fFlags A combination of the RTREQFLAGS values.
208 * @param pfnFunction Pointer to the function to call.
209 * @param cArgs Number of arguments following in the ellipsis.
210 * @param ... Function arguments.
211 *
212 * @remarks See remarks on RTReqQueueCallV.
213 */
214RTDECL(int) RTReqQueueCallEx(RTREQQUEUE hQueue, PRTREQ *ppReq, RTMSINTERVAL cMillies, unsigned fFlags, PFNRT pfnFunction, unsigned cArgs, ...);
215
216/**
217 * Allocate and queue a call request.
218 *
219 * If it's desired to poll on the completion of the request set cMillies
220 * to 0 and use RTReqWait() to check for completion. In the other case
221 * use RT_INDEFINITE_WAIT.
222 * The returned request packet must be freed using RTReqRelease().
223 *
224 * @returns iprt status code.
225 * Will not return VERR_INTERRUPTED.
226 * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.
227 *
228 * @param hQueue The request queue.
229 * @param ppReq Where to store the pointer to the request.
230 * This will be NULL or a valid request pointer not matter what happens, unless fFlags
231 * contains RTREQFLAGS_NO_WAIT when it will be optional and always NULL.
232 * @param cMillies Number of milliseconds to wait for the request to
233 * be completed. Use RT_INDEFINITE_WAIT to only
234 * wait till it's completed.
235 * @param fFlags A combination of the RTREQFLAGS values.
236 * @param pfnFunction Pointer to the function to call.
237 * @param cArgs Number of arguments following in the ellipsis.
238 * @param Args Variable argument vector.
239 *
240 * @remarks Caveats:
241 * - Do not pass anything which is larger than an uintptr_t.
242 * - 64-bit integers are larger than uintptr_t on 32-bit hosts.
243 * Pass integers > 32-bit by reference (pointers).
244 * - Don't use NULL since it should be the integer 0 in C++ and may
245 * therefore end up with garbage in the bits 63:32 on 64-bit
246 * hosts because 'int' is 32-bit.
247 * Use (void *)NULL or (uintptr_t)0 instead of NULL.
248 */
249RTDECL(int) RTReqQueueCallV(RTREQQUEUE hQueue, PRTREQ *ppReq, RTMSINTERVAL cMillies, unsigned fFlags, PFNRT pfnFunction, unsigned cArgs, va_list Args);
250
251/**
252 * Checks if the queue is busy or not.
253 *
254 * The caller is responsible for dealing with any concurrent submitts.
255 *
256 * @returns true if busy, false if idle.
257 * @param hQueue The queue.
258 */
259RTDECL(bool) RTReqQueueIsBusy(RTREQQUEUE hQueue);
260
261/**
262 * Allocates a request packet.
263 *
264 * The caller allocates a request packet, fills in the request data
265 * union and queues the request.
266 *
267 * @returns iprt status code.
268 *
269 * @param hQueue The request queue.
270 * @param enmType Package type.
271 * @param phReq Where to store the handle to the new request.
272 */
273RTDECL(int) RTReqQueueAlloc(RTREQQUEUE hQueue, RTREQTYPE enmType, PRTREQ *phReq);
274
275
276/**
277 * Creates a request thread pool.
278 *
279 * The core configuration is given as parameters, finer pool tuning can be
280 * achieved via RTReqPoolSetCfgVar.
281 *
282 * @returns IPRT status code.
283 * @param cMaxThreads The maximum number of worker threads.
284 * UINT32_MAX is an alias for the highest
285 * allowed thread count.
286 * @param cMsMinIdle The number of milliseconds a worker
287 * thread needs to be idle before it is
288 * considered for shutdown. The value
289 * RT_INDEFINITE_WAIT disables automatic
290 * idle thread shutdown.
291 * @param cThreadsPushBackThreshold At which worker thread count the push
292 * back should kick in.
293 * @param cMsMaxPushBack The max number of milliseconds to push
294 * back a submitter. UINT32_MAX is an
295 * alias for the highest allowed push back.
296 * @param pszName The pool name. Keep it short as it is
297 * used for naming worker threads.
298 * @param phPool Where to return the pool handle.
299 */
300RTDECL(int) RTReqPoolCreate(uint32_t cMaxThreads, RTMSINTERVAL cMsMinIdle,
301 uint32_t cThreadsPushBackThreshold, uint32_t cMsMaxPushBack,
302 const char *pszName, PRTREQPOOL phPool);
303
304/**
305 * Retainsa reference to a request thread pool.
306 *
307 * @returns The new reference count, UINT32_MAX on invalid handle (asserted).
308 * @param hPool The request thread pool handle.
309 */
310RTDECL(uint32_t) RTReqPoolRetain(RTREQPOOL hPool);
311
312/**
313 * Releases a reference to the request thread pool.
314 *
315 * When the reference count reaches zero, the request will be pooled for reuse.
316 *
317 * @returns The new reference count, UINT32_MAX on invalid handle (asserted).
318 * @param hPool The request thread pool handle.
319 */
320RTDECL(uint32_t) RTReqPoolRelease(RTREQPOOL hPool);
321
322/**
323 * Request thread pool configuration variable.
324 */
325typedef enum RTREQPOOLCFGVAR
326{
327 /** Invalid zero value. */
328 RTREQPOOLCFGVAR_INVALID = 0,
329 /** The desired RTTHREADTYPE of the worker threads. */
330 RTREQPOOLCFGVAR_THREAD_TYPE,
331 /** The minimum number of threads to keep handy once spawned. */
332 RTREQPOOLCFGVAR_MIN_THREADS,
333 /** The maximum number of thread to start. */
334 RTREQPOOLCFGVAR_MAX_THREADS,
335 /** The minimum number of milliseconds a worker thread needs to be idle
336 * before we consider shutting it down. The other shutdown criteria
337 * being set by RTREQPOOLCFGVAR_MIN_THREADS. The value
338 * RT_INDEFINITE_WAIT can be used to disable shutting down idle threads. */
339 RTREQPOOLCFGVAR_MS_MIN_IDLE,
340 /** The sleep period, in milliseoncds, to employ when idling. The value
341 * RT_INDEFINITE_WAIT can be used to disable shutting down idle threads. */
342 RTREQPOOLCFGVAR_MS_IDLE_SLEEP,
343 /** The number of threads at which to start pushing back. The value
344 * UINT64_MAX is an alias for the current upper thread count limit, i.e.
345 * disabling push back. The value 0 (zero) is an alias for the current
346 * lower thread count, a good value to start pushing back at. The value
347 * must otherwise be within */
348 RTREQPOOLCFGVAR_PUSH_BACK_THRESHOLD,
349 /** The minimum push back time in milliseconds. */
350 RTREQPOOLCFGVAR_PUSH_BACK_MIN_MS,
351 /** The maximum push back time in milliseconds. */
352 RTREQPOOLCFGVAR_PUSH_BACK_MAX_MS,
353 /** The maximum number of free requests to keep handy for recycling. */
354 RTREQPOOLCFGVAR_MAX_FREE_REQUESTS,
355 /** The end of the range of valid config variables. */
356 RTREQPOOLCFGVAR_END,
357 /** Blow the type up to 32-bits. */
358 RTREQPOOLCFGVAR_32BIT_HACK = 0x7fffffff
359} RTREQPOOLCFGVAR;
360
361
362/**
363 * Sets a config variable for a request thread pool.
364 *
365 * @returns IPRT status code.
366 * @param hPool The pool handle.
367 * @param enmVar The variable to set.
368 * @param uValue The new value.
369 */
370RTDECL(int) RTReqPoolSetCfgVar(RTREQPOOL hPool, RTREQPOOLCFGVAR enmVar, uint64_t uValue);
371
372/**
373 * Gets a config variable for a request thread pool.
374 *
375 * @returns The value, UINT64_MAX on invalid parameters.
376 * @param hPool The pool handle.
377 * @param enmVar The variable to query.
378 */
379RTDECL(uint64_t) RTReqPoolGetCfgVar(RTREQPOOL hPool, RTREQPOOLCFGVAR enmVar);
380
381/**
382 * Request thread pool statistics value names.
383 */
384typedef enum RTREQPOOLSTAT
385{
386 /** The invalid zero value, as per tradition. */
387 RTREQPOOLSTAT_INVALID = 0,
388 /** The current number of worker threads. */
389 RTREQPOOLSTAT_THREADS,
390 /** The number of threads that have been created. */
391 RTREQPOOLSTAT_THREADS_CREATED,
392 /** The total number of requests that have been processed. */
393 RTREQPOOLSTAT_REQUESTS_PROCESSED,
394 /** The total number of requests that have been submitted. */
395 RTREQPOOLSTAT_REQUESTS_SUBMITTED,
396 /** the current number of pending (waiting) requests. */
397 RTREQPOOLSTAT_REQUESTS_PENDING,
398 /** The current number of active (executing) requests. */
399 RTREQPOOLSTAT_REQUESTS_ACTIVE,
400 /** The current number of free (recycled) requests. */
401 RTREQPOOLSTAT_REQUESTS_FREE,
402 /** Total time the requests took to process. */
403 RTREQPOOLSTAT_NS_TOTAL_REQ_PROCESSING,
404 /** Total time the requests had to wait in the queue before being
405 * scheduled. */
406 RTREQPOOLSTAT_NS_TOTAL_REQ_QUEUED,
407 /** Average time the requests took to process. */
408 RTREQPOOLSTAT_NS_AVERAGE_REQ_PROCESSING,
409 /** Average time the requests had to wait in the queue before being
410 * scheduled. */
411 RTREQPOOLSTAT_NS_AVERAGE_REQ_QUEUED,
412 /** The end of the valid statistics value names. */
413 RTREQPOOLSTAT_END,
414 /** Blow the type up to 32-bit. */
415 RTREQPOOLSTAT_32BIT_HACK = 0x7fffffff
416} RTREQPOOLSTAT;
417
418/**
419 * Read a statistics value from the request thread pool.
420 *
421 * @returns The value, UINT64_MAX if an invalid parameter was given.
422 * @param hPool The request thread pool handle.
423 * @param enmStat The statistics value to get.
424 */
425RTDECL(uint64_t) RTReqPoolGetStat(RTREQPOOL hPool, RTREQPOOLSTAT enmStat);
426
427/**
428 * Allocates a request packet.
429 *
430 * This is mostly for internal use, please use the convenience methods.
431 *
432 * @returns iprt status code.
433 *
434 * @param hPool The request thread pool handle.
435 * @param enmType Package type.
436 * @param phReq Where to store the handle to the new request.
437 */
438RTDECL(int) RTReqPoolAlloc(RTREQPOOL hPool, RTREQTYPE enmType, PRTREQ *phReq);
439
440/**
441 * Call a function on a worker thread.
442 *
443 * @returns IPRT status code.
444 * @param hPool The request thread pool handle.
445 * @param cMillies The number of milliseconds to wait for the request
446 * to be processed.
447 * @param phReq Where to return the request. Can be NULL if the
448 * RTREQFLAGS_NO_WAIT flag is used.
449 * @param fFlags A combination of RTREQFLAGS values.
450 * @param pfnFunction The function to be called. Must be declared by a
451 * DECL macro because of calling conventions.
452 * @param cArgs The number of arguments in the ellipsis.
453 * @param ... Arguments.
454 *
455 * @remarks The function better avoid taking uint64_t and structs as part of the
456 * arguments (use pointers to these instead). In general anything
457 * that's larger than an uintptr_t is problematic.
458 */
459RTDECL(int) RTReqPoolCallEx( RTREQPOOL hPool, RTMSINTERVAL cMillies, PRTREQ *phReq, uint32_t fFlags, PFNRT pfnFunction, unsigned cArgs, ...);
460
461
462/**
463 * Call a function on a worker thread.
464 *
465 * @returns IPRT status code.
466 * @param hPool The request thread pool handle.
467 * @param cMillies The number of milliseconds to wait for the request
468 * to be processed.
469 * @param phReq Where to return the request. Can be NULL if the
470 * RTREQFLAGS_NO_WAIT flag is used.
471 * @param fFlags A combination of RTREQFLAGS values.
472 * @param pfnFunction The function to be called. Must be declared by a
473 * DECL macro because of calling conventions.
474 * @param cArgs The number of arguments in the variable argument
475 * list.
476 * @param va Arguments.
477 * @remarks See remarks on RTReqPoolCallEx.
478 */
479RTDECL(int) RTReqPoolCallExV(RTREQPOOL hPool, RTMSINTERVAL cMillies, PRTREQ *phReq, uint32_t fFlags, PFNRT pfnFunction, unsigned cArgs, va_list va);
480
481/**
482 * Call a function on a worker thread, wait for it to return.
483 *
484 * @returns IPRT status code returned by @a pfnFunction or request pool error.
485 * @param hPool The request thread pool handle.
486 * @param pfnFunction The function to be called. Must be declared by a
487 * DECL macro because of calling conventions. The
488 * function must return an int value compatible with
489 * the IPRT status code convention.
490 * @param cArgs The number of arguments in the elipsis.
491 * @param ... Arguments.
492 * @remarks See remarks on RTReqPoolCallEx.
493 */
494RTDECL(int) RTReqPoolCallWait(RTREQPOOL hPool, PFNRT pfnFunction, unsigned cArgs, ...);
495
496/**
497 * Call a function on a worker thread, don't wait for it to return.
498 *
499 * @returns IPRT status code.
500 * @param hPool The request thread pool handle.
501 * @param pfnFunction The function to be called. Must be declared by a
502 * DECL macro because of calling conventions. The
503 * function should return an int value compatible with
504 * the IPRT status code convention, thought it's not
505 * all that important as it's thrown away.
506 * @param cArgs The number of arguments in the elipsis.
507 * @param ... Arguments.
508 * @remarks See remarks on RTReqPoolCallEx.
509 */
510RTDECL(int) RTReqPoolCallNoWait(RTREQPOOL hPool, PFNRT pfnFunction, unsigned cArgs, ...);
511
512/**
513 * Call a void function on a worker thread.
514 *
515 * @returns IPRT status code.
516 * @param hPool The request thread pool handle.
517 * @param pfnFunction The function to be called. Must be declared by a
518 * DECL macro because of calling conventions. The
519 * function is taken to return void.
520 * @param cArgs The number of arguments in the elipsis.
521 * @param ... Arguments.
522 * @remarks See remarks on RTReqPoolCallEx.
523 */
524RTDECL(int) RTReqPoolCallVoidWait(RTREQPOOL hPool, PFNRT pfnFunction, unsigned cArgs, ...);
525
526/**
527 * Call a void function on a worker thread, don't wait for it to return.
528 *
529 * @returns IPRT status code.
530 * @param hPool The request thread pool handle.
531 * @param pfnFunction The function to be called. Must be declared by a
532 * DECL macro because of calling conventions. The
533 * function is taken to return void.
534 * @param cArgs The number of arguments in the elipsis.
535 * @param ... Arguments.
536 * @remarks See remarks on RTReqPoolCallEx.
537 */
538RTDECL(int) RTReqPoolCallVoidNoWait(RTREQPOOL hPool, PFNRT pfnFunction, unsigned cArgs, ...);
539
540
541/**
542 * Retainsa reference to a request.
543 *
544 * @returns The new reference count, UINT32_MAX on invalid handle (asserted).
545 * @param hReq The request handle.
546 */
547RTDECL(uint32_t) RTReqRetain(PRTREQ hReq);
548
549/**
550 * Releases a reference to the request.
551 *
552 * When the reference count reaches zero, the request will be pooled for reuse.
553 *
554 * @returns The new reference count, UINT32_MAX on invalid handle (asserted).
555 * @param hReq Package to release.
556 */
557RTDECL(uint32_t) RTReqRelease(PRTREQ hReq);
558
559/**
560 * Queue a request.
561 *
562 * The quest must be allocated using RTReqQueueAlloc() or RTReqPoolAlloc() and
563 * contain all the required data.
564 *
565 * If it's desired to poll on the completion of the request set cMillies
566 * to 0 and use RTReqWait() to check for completion. In the other case
567 * use RT_INDEFINITE_WAIT.
568 *
569 * @returns iprt status code.
570 * Will not return VERR_INTERRUPTED.
571 * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.
572 *
573 * @param pReq The request to queue.
574 * @param cMillies Number of milliseconds to wait for the request to
575 * be completed. Use RT_INDEFINITE_WAIT to only
576 * wait till it's completed.
577 */
578RTDECL(int) RTReqSubmit(PRTREQ pReq, RTMSINTERVAL cMillies);
579
580
581/**
582 * Wait for a request to be completed.
583 *
584 * @returns iprt status code.
585 * Will not return VERR_INTERRUPTED.
586 * @returns VERR_TIMEOUT if cMillies was reached without the packet being completed.
587 *
588 * @param pReq The request to wait for.
589 * @param cMillies Number of milliseconds to wait.
590 * Use RT_INDEFINITE_WAIT to only wait till it's completed.
591 */
592RTDECL(int) RTReqWait(PRTREQ pReq, RTMSINTERVAL cMillies);
593
594/**
595 * Get the status of the request.
596 *
597 * @returns Status code in the IPRT tradition.
598 *
599 * @param pReq The request.
600 */
601RTDECL(int) RTReqGetStatus(PRTREQ pReq);
602
603#endif /* IN_RING3 */
604
605
606/** @} */
607
608RT_C_DECLS_END
609
610#endif
611
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette