Standard library header <threads.h> (C11)
From cppreference.net
이 헤더는 병행성 지원 라이브러리 의 일부이며 스레드, 상호 배제, 조건 변수, 스레드별 저장소에 대한 지원을 제공합니다.
목차 |
스레드
thrd_t
|
스레드를 식별하는 구현 정의 완전 객체 타입 |
|
(C11)
|
스레드를 생성함
(함수) |
|
(C11)
|
두 식별자가 동일한 스레드를 참조하는지 확인함
(함수) |
|
(C11)
|
현재 스레드 식별자를 얻음
(함수) |
|
(C11)
|
호출 스레드의 실행을 주어진 시간 동안 일시 중단함
(함수) |
|
(C11)
|
현재 타임 슬라이스를 양보함
(함수) |
|
(C11)
|
호출 스레드를 종료함
(함수) |
|
(C11)
|
스레드를 분리함
(함수) |
|
(C11)
|
스레드가 종료될 때까지 블록함
(함수) |
|
스레드 오류 상태를 나타냄
(상수) |
|
|
thrd_start_t
(C11)
|
함수 포인터 타입의 typedef,
int
(
*
)
(
void
*
)
,
thrd_create
에서 사용됨
(typedef) |
상호 배제
mtx_t
|
뮤텍스 식별자 |
|
(C11)
|
뮤텍스를 생성함
(함수) |
|
(C11)
|
뮤텍스를 잠글 때까지 블록함
(함수) |
|
(C11)
|
뮤텍스를 잠글 때까지 블록하거나 타임아웃됨
(함수) |
|
(C11)
|
뮤텍스를 잠그거나 이미 잠겨 있으면 블록하지 않고 반환함
(함수) |
|
(C11)
|
뮤텍스를 해제함
(함수) |
|
(C11)
|
뮤텍스를 파괴함
(함수) |
|
(C11)
(C11)
(C11)
|
뮤텍스의 유형을 정의함
(열거형) |
한 번 호출 |
|
|
(C11)
|
함수를 정확히 한 번 호출함
(함수) |
조건 변수
cnd_t
|
조건 변수 식별자 |
|
(C11)
|
조건 변수를 생성함
(함수) |
|
(C11)
|
조건 변수에서 블록된 하나의 스레드를 블록 해제함
(함수) |
|
(C11)
|
조건 변수에서 블록된 모든 스레드를 블록 해제함
(함수) |
|
(C11)
|
조건 변수에서 블록함
(함수) |
|
(C11)
|
조건 변수에서 블록함, 타임아웃과 함께
(함수) |
|
(C11)
|
조건 변수를 파괴함
(함수) |
스레드 지역 저장소
|
(C11)
(C23에서 제거됨)
|
스토리지 클래스 지정자
_Thread_local
의 편의 매크로
(키워드 매크로) |
tss_t
|
스레드별 스토리지 포인터 |
|
(C11)
|
소멸자가 호출되는 최대 횟수
(매크로 상수) |
tss_dtor_t
(C11)
|
함수 포인터 타입
void
(
*
)
(
void
*
)
, TSS 소멸자에 사용됨
(typedef) |
|
(C11)
|
주어진 소멸자로 스레드별 스토리지 포인터를 생성함
(함수) |
|
(C11)
|
스레드별 스토리지에서 읽음
(함수) |
|
(C11)
|
스레드별 스토리지에 씀
(함수) |
|
(C11)
|
주어진 스레드별 포인터가 보유한 리소스를 해제함
(함수) |
시놉시스
#define __STDC_NO_THREADS__ 202311L #define ONCE_FLAG_INIT /* 설명 참조 */ #define TSS_DTOR_ITERATIONS /* 설명 참조 */ typedef /* 설명 참조 */ cnd_t; typedef /* 설명 참조 */ thrd_t; typedef /* 설명 참조 */ tss_t; typedef /* 설명 참조 */ mtx_t; typedef /* 설명 참조 */ tss_dtor_t; typedef /* 설명 참조 */ thrd_start_t; #define mtx_plain /* 설명 참조 */ #define mtx_recursive /* 설명 참조 */ #define mtx_timed /* 설명 참조 */ #define once_flag /* 설명 참조 */ #define thrd_busy /* 설명 참조 */ #define thrd_error /* 설명 참조 */ #define thrd_nomem /* 설명 참조 */ #define thrd_success /* 설명 참조 */ #define thrd_timedout /* 설명 참조 */ void call_once(once_flag* flag, void (*func)(void)); int cnd_broadcast(cnd_t* cond); void cnd_destroy(cnd_t* cond); int cnd_init(cnd_t* cond); int cnd_signal(cnd_t* cond); int cnd_timedwait(cnd_t* restrict cond, mtx_t* restrict mtx, const struct timespec* restrict ts); int cnd_wait(cnd_t* cond, mtx_t* mtx); void mtx_destroy(mtx_t* mtx); int mtx_init(mtx_t* mtx, int type); int mtx_lock(mtx_t* mtx); int mtx_timedlock(mtx_t* restrict mtx, const struct timespec* restrict ts); int mtx_trylock(mtx_t* mtx); int mtx_unlock(mtx_t* mtx); int thrd_create(thrd_t* thr, thrd_start_t func, void* arg); thrd_t thrd_current(void); int thrd_detach(thrd_t thr); int thrd_equal(thrd_t thr0, thrd_t thr1); [[noreturn]] void thrd_exit(int res); int thrd_join(thrd_t thr, int* res); int thrd_sleep(const struct timespec* duration, struct timespec* remaining); void thrd_yield(void); int tss_create(tss_t* key, tss_dtor_t dtor); void tss_delete(tss_t key); void* tss_get(tss_t key); int tss_set(tss_t key, void* val);