-
Notifications
You must be signed in to change notification settings - Fork 635
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
Add check before pthread_join #1599
Conversation
The set of bug improvements to the OTA demos (across different PRs since the previous release) would be good to add as a single CHANGELOG item point |
/**
* @brief Start OTA demo.
*
* @return EXIT_SUCCESS or EXIT_FAILURE.
*/
static int startOTADemo( void ); static int startOTADemo( void )
{
...
if( returnStatus == EXIT_SUCCESS )
{
returnStatus = pthread_join( threadHandle, NULL );
if( returnStatus != EXIT_SUCCESS )
{
LogError( ( "Failed to join thread"
",error code = %d",
returnStatus ) );
}
}
return returnStatus;
}
if( startOTADemo() != EXIT_FAILURE ) /* Error code of pthread_join will have the same as EXIT_SUCCESS */
{
....
}
if( returnStatus == EXIT_SUCCESS )
{
if( ( returnJoin = pthread_join( threadHandle, NULL ) ) != 0 )
{
LogError( ( "Failed to join thread"
",error code = %d",
returnJoin ) );
returnStatus = EXIT_FAILURE;
}
}
return returnStatus; |
Added in commit |
@pvyawaha Should I raise another issue or you simply make another commit ? You forget to switch LogError to use the new variable diff --git a/demos/ota/ota_demo_core_http/ota_demo_core_http.c b/demos/ota/ota_demo_core_http/ota_demo_core_http.c
index 5e0a8359..2bbb3cdb 100644
--- a/demos/ota/ota_demo_core_http/ota_demo_core_http.c
+++ b/demos/ota/ota_demo_core_http/ota_demo_core_http.c
@@ -2091,13 +2091,13 @@ static int startOTADemo( void )
returnJoin = pthread_join( threadHandle, NULL );
if( returnJoin != 0 )
{
LogError( ( "Failed to join thread"
",error code = %d",
- returnStatus ) );
+ returnJoin ) );
returnStatus = EXIT_FAILURE;
}
}
return returnStatus;
diff --git a/demos/ota/ota_demo_core_mqtt/ota_demo_core_mqtt.c b/demos/ota/ota_demo_core_mqtt/ota_demo_core_mqtt.c
index 4d14ebd5..ed43dca9 100644
--- a/demos/ota/ota_demo_core_mqtt/ota_demo_core_mqtt.c
+++ b/demos/ota/ota_demo_core_mqtt/ota_demo_core_mqtt.c
@@ -1638,13 +1638,13 @@ static int startOTADemo( void )
returnJoin = pthread_join( threadHandle, NULL );
if( returnJoin != 0 )
{
LogError( ( "Failed to join thread"
",error code = %d",
- returnStatus ) );
+ returnJoin ) );
returnStatus = EXIT_FAILURE;
}
}
return returnStatus; |
Thank you for pointing it out, I will fix this. |
Description of changes:
This change adds check so that pthread_join is called only when ota thread is created.
By submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.