Berkeley DB Reference Guide:
Programmer Notes

PrevRefNext

Signal handling

When applications using Berkeley DB receive signals, it is important that they exit gracefully, discarding any Berkeley DB locks that they may hold. This is normally done by setting a flag when a signal arrives and then checking for that flag periodically within the application. Because Berkeley DB is not re-entrant, the signal handler should not attempt to release locks and/or close the database handles itself. Re-entering Berkeley DB is not guaranteed to work correctly, and the results are undefined.

(버클리디비를 사용하는 애플이 시그널을 받을때 잡고있는 락을 릴리즈하면서 부드럽게 종료해야 한다.버클리 디비는 재진입되지 않기때문에 시그널 핸들러는 자체에서 락을 릴리즈하고 디비핸들을 클로즈해서는 안된다.재진입하는 버클리디비는 올바로 작동되지 않고 결과는 정의되어있지 않다.)

If an application exits holding a lock, the situation is no different than if the application crashed, and all applications participating in the database environment must be shut down, and then recovery must be performed. If this is not done, databases may be left in an inconsistent state, or locks the application held may cause unresolvable deadlocks inside the environment, causing applications to hang.

(만약 애플이 락이 걸린채로 종료되면 애플리케이션의 크래시와 별반다를게 없고 디비환경에 참여하는 모든 애플들은 종료되어야 한다.그리고 복구가 실행되어야 한다.만약 그렇지 않으면 디비는 불일치한 상태로 남게 되거나 애플리케이션이 가지는 락은 환경에서 데드락에 빠지고 애플이 멈춰있게 된다.)

Berkeley DB restarts all system calls interrupted by signals, that is, any underlying system calls that return failure with errno set to EINTR will be restarted rather than failing.

(버클리 디비는 시그널에의해 멈춰졌던 모든 시스템콜을 다시 시작한다.즉 EINTR 으로 설정된 errno 를 리턴하는 시스템콜은 실패보다는 재시작된다.)


PrevRefNext

Copyright (c) 1996-2003 Sleepycat Software, Inc. - All rights reserved.