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.