nckernel  0.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Functions
Collaboration diagram for POSIX 세마포어:

Data Structures

struct  timespec
 

Typedefs

typedef void * sem_t
 세마포어 객체 More...
 

Functions

void sem_clear (struct thread *tcb)
 
int sem_destroy (sem_t *sem)
 세마포어 객체를 소멸 시킨다. More...
 
int sem_getvalue (sem_t *sem, int *val)
 지정된 세마포어 객체에서 조건 값을 가져온다. More...
 
int sem_init (sem_t *sem, int pshared, unsigned int value)
 세마포어 객체를 초기화 한다. More...
 
int sem_post (sem_t *sem)
 세마포어 증가 연산을 수행한다. More...
 
int sem_timedwait (sem_t *sem, const struct timespec *abs_timeout)
 지정된 시간 안에 세마포어 감소 연산을 시도해 본다 More...
 
int sem_trywait (sem_t *sem)
 세마포어 감소 연산을 시도해 본다. More...
 
int sem_wait (sem_t *sem)
 세마포어 감소 연산을 수행한다. More...
 

Detailed Description

Author
Sung-jae Park nices.nosp@m.j@ni.nosp@m.cesj..nosp@m.com
Date
2011-8-11

세마포어를 구현한다

Author
Sung-jae Park nices.nosp@m.j@ni.nosp@m.cesj..nosp@m.com
Date
2011-8-11

Typedef Documentation

typedef void* sem_t

세마포어 객체

Definition at line 13 of file semaphore.h.

Function Documentation

void sem_clear ( struct thread tcb)
Note
이 함수는 표준 함수가 아니다. 노출 시키지 않기 위해 semaphore0.h 에 정의한다.

Definition at line 204 of file semaphore.c.

References free(), sem::list, list_entry, list_for_each_safe, thread::sem, and sem_list_info::tcb.

Referenced by pthread_cancel().

Here is the call graph for this function:

Here is the caller graph for this function:

int sem_destroy ( sem_t sem)

세마포어 객체를 소멸 시킨다.

Parameters
[in]sem세마포어 객체
Returns
int 성공시 0 실패이 에러코드
See Also
sem_init()

Definition at line 52 of file semaphore.c.

References assert, EINVAL, free(), sem_list_info::head, sem::list, list_entry, list_for_each_safe, NULL, thread::sem, and sem_list_info::tcb.

Here is the call graph for this function:

int sem_getvalue ( sem_t sem,
int *  val 
)

지정된 세마포어 객체에서 조건 값을 가져온다.

Parameters
[in]sem세마포어 객체
[in]val조건 값
Returns
int 성공시 0, 실패시 에러코드
See Also
sem_init()

Definition at line 186 of file semaphore.c.

References assert, EINVAL, and sem::value.

int sem_init ( sem_t sem,
int  pshared,
unsigned int  value 
)

세마포어 객체를 초기화 한다.

Parameters
[in]sem세마포어 객체
[in]pshared0 이면 쓰레드 공유, 0 이 아니면 프로세스 공유
[in]value세마포어 초기 값
Returns
int 성공시 0 실패시 에러코드
See Also
sem_destroy()

Definition at line 33 of file semaphore.c.

References assert, ENOMEM, sem::list, malloc(), sem::pshared, and sem::value.

Here is the call graph for this function:

int sem_post ( sem_t sem)

세마포어 증가 연산을 수행한다.

Parameters
[in]sem세마포어 객체
Returns
int 성공시 0, 실패시 에러코드
See Also
sem_wait()
sem_trywait()
sem_timedwait()

Definition at line 80 of file semaphore.c.

References assert, EINVAL, free(), sem_list_info::head, irq_local_restore(), irq_local_save(), sem::list, list_entry, LIST_NEXT, NULL, thread::sem, sem_list_info::tcb, and sem::value.

Here is the call graph for this function:

int sem_timedwait ( sem_t sem,
const struct timespec abs_timeout 
)

지정된 시간 안에 세마포어 감소 연산을 시도해 본다

Parameters
[in]sem세마포어 객체
[in]abs_timeout기다릴 시간
Returns
int 성공시 0 실패시 에러코드
See Also
sem_wait()
sem_trywait()

Definition at line 173 of file semaphore.c.

References assert, EINVAL, and ENOSYS.

int sem_trywait ( sem_t sem)

세마포어 감소 연산을 시도해 본다.

Parameters
[in]sem세마포어 객체
Returns
int 성공시 0 실패시 에러코드
See Also
sem_wait()
sem_timedwait()

Definition at line 152 of file semaphore.c.

References assert, EBUSY, EINVAL, irq_local_restore(), irq_local_save(), and sem::value.

Here is the call graph for this function:

int sem_wait ( sem_t sem)

세마포어 감소 연산을 수행한다.

Parameters
[in]sem세마포어 객체
Returns
int 성공시 0 실패시 에러코드
See Also
sem_post()
sem_trywait()
sem_timedwait()

Definition at line 114 of file semaphore.c.

References assert, EINVAL, ENOMEM, sem_list_info::head, irq_local_restore(), irq_local_save(), sem::list, malloc(), pthread_self(), thread::sem, sem_list_info::tcb, and sem::value.

Referenced by fdc_read_deleted_sector(), fdc_read_id(), fdc_read_sector(), fdc_read_track(), fdc_seek(), fdc_verify(), fdc_write_deleted_sector(), and fdc_write_sector().

Here is the call graph for this function:

Here is the caller graph for this function: