2013-03-16 18:37:40 +01:00
|
|
|
/****************************************************************************
|
2018-05-29 21:21:26 +02:00
|
|
|
* libs/libc/pthread/pthread_startup.c
|
2013-03-16 18:37:40 +01:00
|
|
|
*
|
2021-03-02 15:54:21 +01:00
|
|
|
* 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
|
2013-03-16 18:37:40 +01:00
|
|
|
*
|
2021-03-02 15:54:21 +01:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2013-03-16 18:37:40 +01:00
|
|
|
*
|
2021-03-02 15:54:21 +01:00
|
|
|
* 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.
|
2013-03-16 18:37:40 +01:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include <nuttx/config.h>
|
|
|
|
|
|
|
|
#include <pthread.h>
|
|
|
|
#include <assert.h>
|
|
|
|
|
2013-03-17 01:40:49 +01:00
|
|
|
#include <nuttx/userspace.h>
|
2013-03-16 18:37:40 +01:00
|
|
|
|
2020-04-29 21:21:23 +02:00
|
|
|
#if !defined(CONFIG_BUILD_FLAT) && !defined(__KERNEL__)
|
2013-03-16 18:37:40 +01:00
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Type Declarations
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2015-10-03 00:30:35 +02:00
|
|
|
* Public Data
|
2013-03-16 18:37:40 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
2016-02-22 01:08:58 +01:00
|
|
|
* Private Data
|
2013-03-16 18:37:40 +01:00
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Private Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Public Functions
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Name: pthread_startup
|
|
|
|
*
|
|
|
|
* Description:
|
|
|
|
* This function is the user-space, pthread startup function. It is called
|
|
|
|
* from up_pthread_start() in user-mode.
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Input Parameters:
|
2013-03-16 18:37:40 +01:00
|
|
|
* entrypt - The user-space address of the pthread entry point
|
|
|
|
* arg - Standard argument for the pthread entry point
|
|
|
|
*
|
2018-02-01 17:00:02 +01:00
|
|
|
* Returned Value:
|
2013-03-16 18:37:40 +01:00
|
|
|
* None. This function does not return.
|
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
void pthread_startup(pthread_startroutine_t entrypt, pthread_addr_t arg)
|
|
|
|
{
|
|
|
|
pthread_addr_t exit_status;
|
|
|
|
|
|
|
|
DEBUGASSERT(entrypt);
|
|
|
|
|
|
|
|
/* Pass control to the thread entry point. */
|
|
|
|
|
|
|
|
exit_status = entrypt(arg);
|
|
|
|
|
|
|
|
/* The pthread has returned */
|
|
|
|
|
|
|
|
pthread_exit(exit_status);
|
|
|
|
}
|
|
|
|
|
2020-04-29 21:21:23 +02:00
|
|
|
#endif /* !CONFIG_BUILD_FLAT && !__KERNEL__ */
|