-
Notifications
You must be signed in to change notification settings - Fork 380
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test and Potential Fix for Issue #363 Native Windows Condition Variables do not set errno to ETIME #364
Open
mathersm
wants to merge
12
commits into
DOCGroup:master
Choose a base branch
from
mathersm:native_windows_condition_variables
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Test and Potential Fix for Issue #363 Native Windows Condition Variables do not set errno to ETIME #364
Changes from 1 commit
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
1889dc4
Added a test for the return value and errno combination expected when…
mathersm 5ac57a2
Fuzz test doesn't like ACE_Guard<T> so replaced it with the ACE_GUARD…
mathersm 4c52de0
Renamed the test to Condition_Variable_Timeout_Test to reflect the mo…
mathersm 090575a
* Introduced adaptation to method for non-POSIX error codes. ACE_FAIL…
mathersm b6a7b0a
Reverted a change to adapting last error codes on VxWorks
mathersm 4fb88ae
Removed trailiing white space from OS_NS_errno.cpp
mathersm 3764275
Included sdkddkver.h from Windows SDK to ensure we perform OS version…
mathersm f85eb8e
Merge branch 'master' into native_windows_condition_variables
jwillemsen fe74c7e
Layout changes
jwillemsen c519b7f
Removed old comments
jwillemsen dbc67cc
Removed some empty lines
jwillemsen 1b37ca2
Removed empty line
jwillemsen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
|
||
//============================================================================= | ||
/** | ||
* @file Native_Condition_Variable_Test.cpp | ||
* | ||
* This program tests the support of Native Condition Variables on | ||
* Microsoft Windows. It checks that errno is correctly mutated to | ||
* ensure return and errno values are consistent across implementations | ||
* using ACE_Condition. | ||
* | ||
* @author Michael Mathers <[email protected]> | ||
*/ | ||
//============================================================================= | ||
|
||
|
||
#include "test_config.h" | ||
#include "ace/Condition_T.h" | ||
#include "ace/Guard_T.h" | ||
|
||
|
||
int | ||
run_main(int, ACE_TCHAR *[]) | ||
{ | ||
ACE_START_TEST(ACE_TEXT("Native_Condition_Variable_Test")); | ||
|
||
ACE_SYNCH_MUTEX mutex; | ||
ACE_Condition<ACE_SYNCH_MUTEX> cond(mutex); | ||
ACE_Time_Value timeout(1, 0); | ||
bool condition = false; // Condition we are waiting on - will never changed (never intentionally signalled) | ||
int result = 0; | ||
|
||
// Place the wait within a loop such that we don't just pass on account of a spurious wakeup | ||
while (!condition && !(result == -1)) | ||
{ | ||
ACE_Guard<ACE_SYNCH_MUTEX> guard(mutex); | ||
result = cond.wait(&timeout); | ||
} | ||
|
||
// We should've timed out waiting for the condition variable to be signalled | ||
// Expected behavior is to return -1 and have errno set to ETIME | ||
// Note that native Windows condition variable will set errno to ERROR_TIMEOUT instead (mutation required) | ||
ACE_TEST_ASSERT(result == -1); | ||
ACE_TEST_ASSERT(ACE_OS::last_error() == ETIME); | ||
|
||
ACE_END_TEST; | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would propose to remove Native_ from the name of this test, it just tests the condition variable behavior on any platform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, I will probably change it to something like Condition_Variable_Timeout_Test.