2I<Berkeley DB Reference Guide: Programmer Notes[P6

Berkeley DB Reference Guide: Programmer Notes



1

Application signal handling



NWhen applications using Berkeley DB receive signals, it is important that theyNexit gracefully, discarding any Berkeley DB locks that they may hold. This isHnormally done by setting a flag when a signal arrives, and then checkingHfor that flag periodically within the application. As Berkeley DB isInot reentrant, the signal handler should not attempt to release locksHand/or close the database handles itself if there is any question at allTthat Berkeley DB can be reentered. Reentering Berkeley DB is not guaranteed to work(correctly and the results are undefined.

JIf an application exits holding a lock, the situation is no different thanEif the application crashed, and all applications participating in the@database environment must be shutdown, and then recovery must beHperformed. If this is not done, the locks that the application held canFcause unresolvable deadlocks inside the database, and applications may then hang.

RAOÿÿ