patacongo commented on a change in pull request #3626: URL: https://github.com/apache/incubator-nuttx/pull/3626#discussion_r623136987
########## File path: libs/libc/pthread/pthread_exit.c ########## @@ -0,0 +1,72 @@ +/**************************************************************************** + * libs/libc/pthread/pthread_exit.c + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The + * ASF licenses this file to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance with the + * License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + ****************************************************************************/ + +/**************************************************************************** + * Included Files + ****************************************************************************/ + +#include <nuttx/config.h> + +#include <debug.h> +#include <sched.h> + +#include <nuttx/pthread.h> + +/**************************************************************************** + * Public Functions + ****************************************************************************/ + +/**************************************************************************** + * Name: pthread_exit + * + * Description: + * Terminate execution of a thread started with pthread_create. + * + * Input Parameters: + * exit_valie + * + * Returned Value: + * None + * + * Assumptions: + * + ****************************************************************************/ + +void pthread_exit(FAR void *exit_value) +{ Review comment: pthread_exit() must only be called from user space, especially after this change. However, I still see several calls to pthread_exit(). In the original code before your change there are these: sched/pthread/pthread_create.c: pthread_exit(exit_status); sched/signal/sig_default.c: pthread_exit(NULL); sched/task/task_cancelpt.c: pthread_exit(PTHREAD_CANCELED); sched/task/task_cancelpt.c: pthread_exit(PTHREAD_CANCELED); sched/task/task_setcancelstate.c: pthread_exit(PTHREAD_CANCELED); sched/task/task_setcanceltype.c: pthread_exit(PTHREAD_CANCELED); I think this is an error. We must not call pthread_exit() from within the OS without first dropping the privileges to user. Otherwise, the problem that we are trying to solve with this PR is not solved. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
