1/* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. All rights reserved. 3 * 4 * Redistribution and use in source and binary forms, with or without modification, 5 * are permitted provided that the following conditions are met: 6 * 7 * 1. Redistributions of source code must retain the above copyright notice, this list of 8 * conditions and the following disclaimer. 9 * 10 * 2. Redistributions in binary form must reproduce the above copyright notice, this list 11 * of conditions and the following disclaimer in the documentation and/or other materials 12 * provided with the distribution. 13 * 14 * 3. Neither the name of the copyright holder nor the names of its contributors may be used 15 * to endorse or promote products derived from this software without specific prior written 16 * permission. 17 * 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 20 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 21 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 23 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 24 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 25 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 26 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 27 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF 28 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 */ 30 31#ifndef IT_POSIX_PTHREAD_H 32#define IT_POSIX_PTHREAD_H 33 34#include "sched.h" 35#include "signal.h" 36#include "semaphore.h" 37#include "osTest.h" 38#include "pthread.h" 39#include "limits.h" 40#include "unistd.h" 41#include "mqueue.h" 42 43#define PTHREAD_IS_ERROR (-1) 44#define PTHREAD_PRIORITY_TEST 20 45#define PTHREAD_DEFAULT_STACK_SIZE (LOSCFG_BASE_CORE_TSK_DEFAULT_STACK_SIZE) 46#define PTHREAD_KEY_NUM 10 47#define THREAD_NUM 3 48#define PTHREAD_TIMEOUT (THREAD_NUM * 2) 49#define PTHREAD_INTHREAD_TEST 0 /* Control going to or is already for Thread */ 50#define PTHREAD_INMAIN_TEST 1 /* Control going to or is already for Main */ 51#define INVALID_PSHARED_VALUE (-100) 52#define NUM_OF_CONDATTR 10 53#define RUNTIME 5 54#define PTHREAD_THREADS_NUM 3 55#define TCOUNT 5 // Number of single-threaded polling 56#define COUNT_LIMIT 7 // The number of times the signal is sent 57#define HIGH_PRIORITY 5 58#define LOW_PRIORITY 10 59#define PTHREAD_EXIT_VALUE ((void *)100) /* The return code of the thread when using pthread_exit(). */ 60 61#define PTHREAD_EXISTED_NUM TASK_EXISTED_NUM 62#define PTHREAD_EXISTED_SEM_NUM SEM_EXISTED_NUM 63 64/* We are testing conformance to IEEE Std 1003.1, 2003 Edition */ 65 66#define PRIORITY_OTHER (-1) 67#define PRIORITY_FIFO 20 68#define PRIORITY_RR 20 69 70#ifdef LOSCFG_AARCH64 71#define PTHREAD_STACK_MIN_TEST (PTHREAD_STACK_MIN * 3) 72#else 73#define PTHREAD_STACK_MIN_TEST PTHREAD_STACK_MIN 74#endif 75 76pthread_t TestPthreadSelf(void); 77 78VOID ItPosixPthread001(VOID); 79VOID ItPosixPthread002(VOID); 80VOID ItPosixPthread003(VOID); 81VOID ItPosixPthread004(VOID); 82VOID ItPosixPthread005(VOID); 83VOID ItPosixPthread006(VOID); 84VOID ItPosixPthread007(VOID); 85VOID ItPosixPthread008(VOID); 86VOID ItPosixPthread009(VOID); 87VOID ItPosixPthread010(VOID); 88VOID ItPosixPthread011(VOID); 89VOID ItPosixPthread012(VOID); 90VOID ItPosixPthread013(VOID); 91VOID ItPosixPthread014(VOID); 92VOID ItPosixPthread015(VOID); 93VOID ItPosixPthread016(VOID); 94VOID ItPosixPthread017(VOID); 95VOID ItPosixPthread018(VOID); 96VOID ItPosixPthread019(VOID); 97VOID ItPosixPthread020(VOID); 98VOID ItPosixPthread021(VOID); 99VOID ItPosixPthread022(VOID); 100VOID ItPosixPthread023(VOID); 101VOID ItPosixPthread024(VOID); 102VOID ItPosixPthread025(VOID); 103 104#endif /* IT_POSIX_PTHREAD_H */ 105