lib/posix: correct the meaning of CONFIG_MAX_PTHREAD_COUNT
Current code implement CONFIG_MAX_PTHREAD_COUNT as the maximum number of POSIX threads that can ever be created, rather than the maximum number of active POSIX threads. Use pthread_state of struct posix_thread to track the state of posix thread in posix_thread_pool so that we can reuse the unused posix thread. Fixes #15516. Signed-off-by: Wentong Wu <wentong.wu@intel.com>
This commit is contained in:
parent
6f6b46971a
commit
6922d93d8e
3 changed files with 21 additions and 10 deletions
|
@ -18,14 +18,14 @@
|
|||
#include <string.h>
|
||||
|
||||
enum pthread_state {
|
||||
/* The thread structure is unallocated and available for reuse. */
|
||||
PTHREAD_TERMINATED = 0,
|
||||
/* The thread is running and joinable. */
|
||||
PTHREAD_JOINABLE = 0,
|
||||
PTHREAD_JOINABLE,
|
||||
/* The thread is running and detached. */
|
||||
PTHREAD_DETACHED,
|
||||
/* A joinable thread exited and its return code is available. */
|
||||
PTHREAD_EXITED,
|
||||
/* The thread structure is unallocated and available for reuse. */
|
||||
PTHREAD_TERMINATED
|
||||
PTHREAD_EXITED
|
||||
};
|
||||
|
||||
struct posix_thread {
|
||||
|
@ -49,8 +49,8 @@ struct posix_thread {
|
|||
};
|
||||
|
||||
/* Pthread detach/joinable */
|
||||
#define PTHREAD_CREATE_JOINABLE 0
|
||||
#define PTHREAD_CREATE_DETACHED 1
|
||||
#define PTHREAD_CREATE_JOINABLE PTHREAD_JOINABLE
|
||||
#define PTHREAD_CREATE_DETACHED PTHREAD_DETACHED
|
||||
|
||||
/* Pthread cancellation */
|
||||
#define _PTHREAD_CANCEL_POS 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue