mirror of
https://github.com/switchbrew/libnx.git
synced 2025-07-06 11:22:15 +02:00
Fix waitMulti/waitMultiHandle for C++
This commit is contained in:
parent
b56f2c56af
commit
a63207644e
@ -60,8 +60,10 @@ Result waitNHandle(s32* idx_out, Handle* handles, size_t num_handles, u64 timeou
|
|||||||
* @param[in] timeout Timeout (in nanoseconds).
|
* @param[in] timeout Timeout (in nanoseconds).
|
||||||
* @note The number of objects must not be greater than \ref MAX_WAIT_OBJECTS. This is a Horizon kernel limitation.
|
* @note The number of objects must not be greater than \ref MAX_WAIT_OBJECTS. This is a Horizon kernel limitation.
|
||||||
*/
|
*/
|
||||||
#define waitMulti(idx_out, timeout, ...) \
|
#define waitMulti(idx_out, timeout, ...) ({ \
|
||||||
waitN((idx_out), (Waiter[]) { __VA_ARGS__ }, sizeof((Waiter[]) { __VA_ARGS__ }) / sizeof(Waiter), (timeout))
|
Waiter __objects[] = { __VA_ARGS__ }; \
|
||||||
|
waitN((idx_out), __objects, sizeof(__objects) / sizeof(Waiter), (timeout)); \
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Waits for an arbitrary number of handles. This is a macro that uses var-args.
|
* @brief Waits for an arbitrary number of handles. This is a macro that uses var-args.
|
||||||
@ -69,8 +71,10 @@ Result waitNHandle(s32* idx_out, Handle* handles, size_t num_handles, u64 timeou
|
|||||||
* @param[in] timeout Timeout (in nanoseconds).
|
* @param[in] timeout Timeout (in nanoseconds).
|
||||||
* @note The number of objects must not be greater than \ref MAX_WAIT_OBJECTS. This is a Horizon kernel limitation.
|
* @note The number of objects must not be greater than \ref MAX_WAIT_OBJECTS. This is a Horizon kernel limitation.
|
||||||
*/
|
*/
|
||||||
#define waitMultiHandle(idx_out, timeout, ...) \
|
#define waitMultiHandle(idx_out, timeout, ...) ({ \
|
||||||
waitNHandle((idx_out), (Handle[]) { __VA_ARGS__ }, sizeof((Handle[]) { __VA_ARGS__ }) / sizeof(Handle), (timeout))
|
Handle __handles[] = { __VA_ARGS__ }; \
|
||||||
|
waitNHandle((idx_out), __handles, sizeof(__handles) / sizeof(Handle), (timeout)); \
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Waits for a single waiter.
|
* @brief Waits for a single waiter.
|
||||||
|
Loading…
Reference in New Issue
Block a user