pthread_rwlock_rdlock(3p) - wariua/manpages-ko GitHub Wiki
μ΄ λ§€λ΄μΌ νμ΄μ§λ POSIX νλ‘κ·Έλλ¨Έ λ§€λ΄μΌμ μΌλΆμ΄λ€. μ΄ μΈν°νμ΄μ€μ 리λ μ€ κ΅¬νμ μ°¨μ΄κ° μμ μ μμΌλ©° (μμΈν 리λ μ€ λμ λ°©μμ ν΄λΉ 리λ μ€ λ§€λ΄μΌ νμ΄μ§ μ°Έκ³ ) 리λ μ€μμ μ΄ μΈν°νμ΄μ€κ° ꡬνλμ΄ μμ§ μμ μλ μλ€.
pthread_rwlock_rdlock, pthread_rwlock_tryrdlock - μ½κΈ°-μ°κΈ° λ½ κ°μ²΄λ₯Ό μ½κΈ°μ©μΌλ‘ μ κ·ΈκΈ°
#include <pthread.h>
int pthread_rwlock_rdlock(pthread_rwlock_t *rwlock);
int pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock);
pthread_rwlock_rdlock()
ν¨μλ rwlock
μ΄ κ°λ¦¬ν€λ μ½κΈ°-μ°κΈ° λ½μ μ½κΈ° λ½μ μ μ©νλ€. μ°κΈ° μͺ½μ΄ λ½μ μ‘κ³ μμ§ μκ³ λ½μ λΈλ‘ λ μ°κΈ° μͺ½μ΄ μμΌλ©΄ νΈμΆ μ€λ λκ° μ½κΈ° λ½μ νλνλ€.
Thread Execution Scheduling μ΅μ
μ μ§μνλ©° λ½μ κ΄λ ¨λ μ€λ λλ€μ΄ μ€μΌμ€λ§ μ μ±
SCHED_FIFO
λ SCHED_RR
λ‘ μ€ν μ€μΈ κ²½μ°, μ°κΈ° μͺ½μ΄ λ½μ μ‘κ³ μκ±°λ λ λκ±°λ κ°μ μ°μ μμμ μ°κΈ° μͺ½μ΄ λ½μ λΈλ‘ λμ΄ μμΌλ©΄ νΈμΆ μ€λ λκ° λ½μ νλνμ§ μλλ€. μλλ©΄ νΈμΆ μ€λ λκ° λ½μ νλνλ€.
Thread Execution Scheduling μ΅μ
μ μ§μνλ©° λ½μ κ΄λ ¨λ μ€λ λλ€μ΄ μ€μΌμ€λ§ μ μ±
SCHED_SPORADIC
μΌλ‘ μ€ν μ€μΈ κ²½μ°, μ°κΈ° μͺ½μ΄ λ½μ μ‘κ³ μκ±°λ λ λκ±°λ κ°μ μ°μ μμμ μ°κΈ° μͺ½μ΄ λ½μ λΈλ‘ λμ΄ μμΌλ©΄ νΈμΆ μ€λ λκ° λ½μ νλνμ§ μλλ€. μλλ©΄ νΈμΆ μ€λ λκ° λ½μ νλνλ€.
Thread Execution Scheduling μ΅μ μ μ§μνμ§ μλ κ²½μ°, μ°κΈ° μͺ½μ΄ λ½μ μ‘κ³ μμ§ μκ³ λ½μ λΈλ‘ λ μ°κΈ° μͺ½μ΄ μμ λ νΈμΆ μ€λ λκ° λ½μ νλνλμ§ μ¬λΆλ ꡬνμμ κ·μ νλ€. μ°κΈ° μͺ½μ΄ λ½μ μ‘κ³ μμΌλ©΄ νΈμΆ μ€λ λκ° μ½κΈ° λ½μ νλνμ§ μλλ€. μ½κΈ° λ½μ νλνμ§ μλ κ²½μ° νΈμΆ μ€λ λλ λ½μ νλν μ μκ² λ λκΉμ§ λΈλ‘ νλ€. νΈμΆμ΄ μ΄λ€μ§λ μμ μ νΈμΆ μ€λ λκ° μ°κΈ° λ½μ μ‘κ³ μλ€λ©΄ κ΅μ°©μ΄ μΌμ΄λ μλ μλ€.
ν μ€λ λμμ rwlock
μ λμμ μ½κΈ° λ½μ μ¬λ¬ κ° μ‘κ³ μμ μλ (μ¦ pthread_rwlock_rdlock()
ν¨μλ₯Ό n
λ² μ±κ³΅μ μΌλ‘ νΈμΆν μ) μλ€. κ·Έλ° κ²½μ°μ μμ©μμλ κ·Έ μ€λ λκ° λμνλ νκΈ°λ₯Ό μννλλ‘ (μ¦ pthread_rwlock_unlock()
ν¨μλ₯Ό n
λ² νΈμΆνλλ‘) ν΄μΌ νλ€.
ꡬνμμ μ½κΈ°-μ°κΈ° λ½μ μ μ© κ°λ₯νλ€κ³ 보μ₯νλ λμ μ½κΈ° λ½ μ΅λ μλ ꡬνμμ κ·μ νλ€. κ·Έ μ΅λκ°μ μ΄κ³Όνκ² λλ κ²½μ° pthread_rwlock_rdlock()
ν¨μκ° μ€ν¨ν μλ μλ€.
pthread_rwlock_tryrdlock()
ν¨μλ pthread_rwlock_rdlock()
ν¨μμ²λΌ μ½κΈ° λ½μ μ μ©νλ λλ±ν pthread_rwlock_rdlock()
νΈμΆμ΄ νΈμΆ μ€λ λλ₯Ό λΈλ‘ μν€κ² λ κ²½μ°μ ν¨μκ° μ€ν¨νκ² λλ€. μ΄λ€ κ²½μ°μλ pthread_rwlock_tryrdlock()
ν¨μλ μ λ λΈλ‘ νμ§ μλλ€. λ½μ νλνκ±°λ μ€ν¨νκ³ μ¦μ λ°ννλ€.
μ΄κΈ°ν μ λ μ½κΈ°-μ°κΈ° λ½μΌλ‘ μ΄ ν¨μλ€μ νΈμΆνλ κ²½μ°μ κ²°κ³Όλ κ·μ λμ΄ μμ§ μλ€.
μ½κΈ°-μ°κΈ° λ½μ μ½κΈ°μ©μΌλ‘ λκΈ° μ€μΈ μ€λ λμκ² μκ·Έλμ΄ μ λ¬λλ κ²½μ° μκ·Έλ νΈλ€λ¬μμ λ°νν μ€λ λκ° μ€λ¨λ μ μλ κ²μ²λΌ λ€μ μ½κΈ°-μ°κΈ° λ½μ μ½κΈ°μ©μΌλ‘ λκΈ°νλ€.
μ±κ³΅ μ pthread_rwlock_rdlock()
ν¨μλ 0μ λ°ννλ€. μλλ©΄ μ€λ₯λ₯Ό λνλ΄λ μ€λ₯ λ²νΈλ₯Ό λ°ννλ€.
pthread_rwlock_tryrdlock()
ν¨μλ rwlock
μ΄ κ°λ¦¬ν€λ μ½κΈ°-μ°κΈ° λ½ κ°μ²΄μμ μ½κΈ°μ© λ½μ νλν κ²½μ° 0μ λ°ννλ€. μλλ©΄ μ€λ₯λ₯Ό λνλ΄λ μ€λ₯ λ²νΈλ₯Ό λ°ννλ€.
λ€μ κ²½μ°μ pthread_rwlock_tryrdlock()
ν¨μκ° μ€ν¨νλ€.
EBUSY
- μ°κΈ° μͺ½μ΄ λ½μ μ‘κ³ μκ±°λ μ μ ν μ°μ μμμ μ°κΈ° μͺ½μ΄ λ½μ λΈλ‘ λμ΄ μμ΄μ μ½κΈ°-μ°κΈ° λ½μ νλν μ μλ€.
λ€μ κ²½μ°μ pthread_rwlock_rdlock()
λ° pthread_rwlock_tryrdlock()
ν¨μκ° μ€ν¨ν μλ μλ€.
EAGAIN
-
rwlock
μ λν μ½κΈ° λ½ μ΅λ νμλ₯Ό μ΄κ³ΌνκΈ° λλ¬Έμ μ½κΈ° λ½μ νλν μ μλ€.
λ€μ κ²½μ°μ pthread_rwlock_rdlock()
ν¨μκ° μ€ν¨ν μλ μλ€.
EDEADLK
- κ΅μ°© 쑰건μ νμ§νκ±°λ νμ¬ μ€λ λκ° μ΄λ―Έ κ·Έ μ½κΈ°-μ°κΈ° λ½μ μ°κΈ°μ©μΌλ‘ κ°μ§κ³ μλ€.
μ΄ ν¨μλ€μ μ€λ₯ μ½λ [EINTR]
μ λ°ννμ§ μλλ€.
μ΄νλ κ·λ²μ μ΄μ§ μμ λ΄μ©μ΄λ€.
μμ.
μ΄ ν¨μλ€μ μ°λ μμ©μμ POSIX.1-2008 Base Definitions κΆμ 3.287μ Priority Inversionμμ λ Όμνλ μ°μ μμ μμ μ κ²ͺμ μ μλ€.
pthread_rwlock_rdlock()
μ΄λ pthread_rwlock_tryrdlock()
μ rwlock
μΈμλ‘ μ§μ ν κ°μ΄ μ΄κΈ°ν λ μ½κΈ°-μ°κΈ° λ½ κ°μ²΄λ₯Ό κ°λ¦¬ν€κ³ μμ§ μμμ ꡬνμμ κ°μ§νλ κ²½μ° ν¨μλ₯Ό μ€ν¨ μ²λ¦¬νκ³ [EINVAL]
μ€λ₯λ₯Ό λ³΄κ³ νκΈ°λ₯Ό κΆμ₯νλ€.
μμ.
pthread_rwlock_destroy(), pthread_rwlock_timedrdlock(), pthread_rwlock_timedwrlock(), pthread_rwlock_trywrlock(), pthread_rwlock_unlock()
POSIX.1-2008 Base Definitions κΆ, 3.287μ Priority Inversion, 4.11μ Memory Synchronization, <pthread.h>
Portions of this text are reprinted and reproduced in electronic form from IEEE Std 1003.1, 2013 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 7, Copyright (C) 2013 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. (This is POSIX.1-2008 with the 2013 Technical Corrigendum 1 applied.) In the event of any discrepancy between this version and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.unix.org/online.html .
Any typographical or formatting errors that appear in this page are most likely to have been introduced during the conversion of the source files to man page format. To report such errors, see https://www.kernel.org/doc/man-pages/reporting_bugs.html .
2013