Skip to content
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

testing/ostest: adjust PTHREAD_CLEANUP_STACKSIZE with nuttx project #1792

Merged
merged 1 commit into from
Jun 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion testing/ostest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ ifneq ($(CONFIG_TLS_NELEM),0)
CSRCS += specific.c
endif

ifeq ($(CONFIG_PTHREAD_CLEANUP),y)
ifneq ($(CONFIG_PTHREAD_CLEANUP_STACKSIZE),0)
CSRCS += pthread_cleanup.c
endif

Expand Down
10 changes: 5 additions & 5 deletions testing/ostest/cancel.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ static sem_t sem_thread_started;
* Private Functions
****************************************************************************/

#ifdef CONFIG_PTHREAD_CLEANUP
#if defined(CONFIG_PTHREAD_CLEANUP_STACKSIZE) && CONFIG_PTHREAD_CLEANUP_STACKSIZE > 0
static void sem_cleaner(FAR void *arg)
{
printf("sem_cleaner #%u\n", (unsigned int)((uintptr_t)arg));
Expand All @@ -60,7 +60,7 @@ static FAR void *sem_waiter(FAR void *parameter)
{
int status;

#ifdef CONFIG_PTHREAD_CLEANUP
#if defined(CONFIG_PTHREAD_CLEANUP_STACKSIZE) && CONFIG_PTHREAD_CLEANUP_STACKSIZE > 0
int i;

/* Register some clean-up handlers */
Expand Down Expand Up @@ -161,7 +161,7 @@ static FAR void *sem_waiter(FAR void *parameter)
}

#if !defined(CONFIG_DISABLE_MQUEUE) && defined(CONFIG_CANCELLATION_POINTS)
#ifdef CONFIG_PTHREAD_CLEANUP
#if defined(CONFIG_PTHREAD_CLEANUP_STACKSIZE) && CONFIG_PTHREAD_CLEANUP_STACKSIZE > 0
static void mqueue_cleaner(FAR void *arg)
{
FAR mqd_t *mqcancel = (FAR mqd_t *)arg;
Expand All @@ -182,7 +182,7 @@ static FAR void *mqueue_waiter(FAR void *parameter)
char msgbuffer[CONFIG_MQ_MAXMSGSIZE];
size_t nbytes;

#ifdef CONFIG_PTHREAD_CLEANUP
#if defined(CONFIG_PTHREAD_CLEANUP_STACKSIZE) && CONFIG_PTHREAD_CLEANUP_STACKSIZE > 0
/* Register clean-up handler */

pthread_cleanup_push(mqueue_cleaner, (FAR void *)&mqcancel);
Expand Down Expand Up @@ -249,7 +249,7 @@ static FAR void *asynch_waiter(FAR void *parameter)
{
int status;

#ifdef CONFIG_PTHREAD_CLEANUP
#if defined(CONFIG_PTHREAD_CLEANUP_STACKSIZE) && CONFIG_PTHREAD_CLEANUP_STACKSIZE > 0
int i;

/* Register some clean-up handlers */
Expand Down
2 changes: 1 addition & 1 deletion testing/ostest/ostest_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ static int user_main(int argc, char *argv[])
pthread_rwlock_cancel_test();
check_test_memory_usage();

#ifdef CONFIG_PTHREAD_CLEANUP
#if defined(CONFIG_PTHREAD_CLEANUP_STACKSIZE) && CONFIG_PTHREAD_CLEANUP_STACKSIZE > 0
/* Verify pthread cancellation cleanup handlers */

printf("\nuser_main: pthread_cleanup test\n");
Expand Down
4 changes: 2 additions & 2 deletions testing/ostest/pthread_rwlock_cancel.c
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ static void test_timeout(void)
* usable state after deferred cancellation.
*/

#ifdef CONFIG_PTHREAD_CLEANUP
#if defined(CONFIG_PTHREAD_CLEANUP_STACKSIZE) && CONFIG_PTHREAD_CLEANUP_STACKSIZE > 0
#ifdef CONFIG_CANCELLATION_POINTS
status = pthread_rwlock_trywrlock(&write_lock);
if (status != EBUSY)
Expand Down Expand Up @@ -256,7 +256,7 @@ static void test_timeout(void)
ASSERT(false);
}
#endif /* CONFIG_CANCELLATION_POINTS */
#endif /* CONFIG_PTHREAD_CLEANUP */
#endif /* defined(CONFIG_PTHREAD_CLEANUP_STACKSIZE) && CONFIG_PTHREAD_CLEANUP_STACKSIZE > 0 */

pthread_rwlock_destroy(&write_lock);
pthread_rwlock_destroy(&read_lock);
Expand Down