@Yulia. Thank you, that is what I meant, and that explanation covers it. FYI only, TL;DR The user of this method wants to be woken up when the monitored value is changed (by any other thread). My assumption was that the notification would be generated by some monitor code in the method. But what you're saying is that if a thread wants to change the value and wait for it to change, they do so and then call `notify()` to wake up other waiting threads and tell them that the value has changed. That's why the wake up string is always "ok" - it's not telling you that the value is `not-equal`, it's telling you that the value might have changed become something else said it was changed. I don't think the docs capture the whole pattern where the thread changes the value, calls notify(), waits, polls, and is notified when something else changes the value. Anyway, thanks again.
Bug 1467846 Comment 78 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
@Yulia. Thank you, that is what I meant, and that explanation covers it. FYI only, TL;DR The user of this method wants to be woken up when the monitored value is changed (by any other thread). My assumption was that the notification would be generated by some monitor code in the method, because I was assuming that the purpose was to monitor values. But the actual purpose is to synchronize threads. So essentially we have a value in shared memory that indicates a sync point. A thread can use awaitSync() to check the value is not the expected sync value and immediately proceed. If it is the expected sync value then the thread waits for the timeout, after which it can poll again, or the promise to resolve with value "ok" which indicates another thread is calling `notify()` - i.e. it is at the sync point. The detail of how you'd actually set this up with multiple sync points is beyond me, but I think this broad understanding is probably enough for now.
@Yulia. Thank you, that is what I meant, and that explanation covers it. FYI only, TL;DR The user of this method wants to be woken up when the monitored value is changed (by any other thread). My assumption was that the notification would be generated by some monitor code in the method, because I was thinking that the purpose was to monitor values. But the actual purpose is to synchronize threads. So essentially we have a value in shared memory that indicates a sync point. A thread can use awaitSync() to check the value is not the expected sync value and immediately proceed. If it is the expected sync value then the thread waits for the timeout, after which it can poll again, or the promise to resolve with value "ok" which indicates another thread is calling `notify()` - i.e. it is at the sync point. The detail of how you'd actually set this up with multiple sync points is beyond me, but I think this broad understanding is probably enough for now.