Fix multiwaiter public header. (#419)
It had a load of left-over things in it from when the scheduler knew
about event groups.
---------
Co-authored-by: Nathaniel Wesley Filardo <wes.filardo@scisemi.com>
diff --git a/sdk/include/multiwaiter.h b/sdk/include/multiwaiter.h
index 9032a72..8b22817 100644
--- a/sdk/include/multiwaiter.h
+++ b/sdk/include/multiwaiter.h
@@ -34,54 +34,24 @@
#include <timeout.h>
/**
- * The kind of event source to wait for in a multiwaiter.
- */
-enum EventWaiterKind
-{
- /// Event source is an event channel.
- EventWaiterEventChannel,
- /// Event source is a futex.
- EventWaiterFutex
-};
-
-enum [[clang::flag_enum]] EventWaiterEventChannelFlags
-{
- /// Automatically clear the bits we waited on.
- EventWaiterEventChannelClearOnExit = (1 << 24),
- /// Notify when all bits were set.
- EventWaiterEventChannelWaitAll = (1 << 26)
-};
-
-/**
* Structure describing a change to the set of managed event sources for an
* event waiter.
*/
struct EventWaiterSource
{
/**
- * A pointer to the event source. For a futex, this should be the memory
- * address. For other sources, it should be a pointer to an object of the
- * corresponding type.
+ * A pointer to the event source. This is the futex that is monitored for
+ * the multiwaiter.
*/
void *eventSource;
/**
- * The kind of the event source. This must match the pointer type.
- */
- enum EventWaiterKind kind;
- /**
- * Event-specific configuration. This field is modified during the wait
- * call. The interpretation of this depends on `kind`:
+ * Event value. This field is modified during the wait
+ * call.
*
- * - `EventWaiterEventChannel`: The low 24 bits contain the bits to
- * monitor, the top bit indicates whether this event is triggered if all
- * of the bits are set (true) or some of them (false). On return, this
- * contains the bits that have been set during the call.
- * - `EventWaiterFutex`: This indicates the value to compare the futex word
- * against. If they mismatch, the event fires immediately.
+ * This indicates the value to compare the futex word against. If they
+ * mismatch, the event fires immediately.
*
- * If waiting for a futex, signal the event immediately if the value
- * does not match. On return, this is set to 1 if the futex is
- * signaled, 0 otherwise.
+ * On return, this is set to 1 if the futex is signaled, 0 otherwise.
*/
uint32_t value;
};
diff --git a/tests/multiwaiter-test.cc b/tests/multiwaiter-test.cc
index 16cbc04..6cc0249 100644
--- a/tests/multiwaiter-test.cc
+++ b/tests/multiwaiter-test.cc
@@ -32,12 +32,12 @@
EventWaiterSource events[4];
debug_log("Testing error case: Invalid values");
- events[0] = {nullptr, static_cast<EventWaiterKind>(5), 0};
+ events[0] = {nullptr, 0};
ret = multiwaiter_wait(&t, mw, events, 1);
TEST(ret == -EINVAL, "multiwaiter returned {}, expected {}", ret, -EINVAL);
debug_log("Testing one futex, already ready");
- events[0] = {&futex, EventWaiterFutex, 1};
+ events[0] = {&futex, 1};
t.remaining = 5;
ret = multiwaiter_wait(&t, mw, events, 1);
TEST(ret == 0, "multiwaiter returned {}, expected 0", ret);
@@ -53,7 +53,7 @@
debug_log("Testing one futex, not yet ready");
setFutex(&futex, 1);
- events[0] = {&futex, EventWaiterFutex, 0};
+ events[0] = {&futex, 0};
t.remaining = 6;
ret = multiwaiter_wait(&t, mw, events, 1);
TEST(ret == 0, "multiwaiter returned {}, expected 0", ret);
@@ -62,8 +62,8 @@
futex = 0;
futex2 = 2;
setFutex(&futex2, 3);
- events[0] = {&futex, EventWaiterFutex, 0};
- events[1] = {&futex2, EventWaiterFutex, 2};
+ events[0] = {&futex, 0};
+ events[1] = {&futex2, 2};
t.remaining = 6;
ret = multiwaiter_wait(&t, mw, events, 2);
TEST(ret == 0, "multiwaiter returned {}, expected 0", ret);
@@ -118,7 +118,7 @@
futex = 0;
setFutex(&futex, 1);
multiwaiter_queue_receive_init(&events[0], queue);
- events[1] = {&futex, EventWaiterFutex, 0};
+ events[1] = {&futex, 0};
t.remaining = 6;
ret = multiwaiter_wait(&t, mw, events, 2);
TEST(ret == 0, "multiwait on futex and queue returned {}", ret);