Hi.. We had a question regarding the lock data structures in the file os_unix.c. The data structure is the lockInfo structure. The fields in the lock info structure are
struct lockInfo { struct lockKey key; /* The lookup key */ int cnt; /* Number of SHARED locks held */ int locktype; /* One of SHARED_LOCK, RESERVED_LOCK etc. */ int nRef; /* Number of pointers to this structure */ }; The lockKey structure is defined as follows struct lockKey { dev_t dev; /* Device number */ ino_t ino; /* Inode number */ #ifdef SQLITE_UNIX_THREADS pthread_t tid; /* Thread ID or zero if threads cannot override each other */ #endif }; The lockKey data structure includes the thread ID. This results in a per thread lock info structure on Linux . The comment at the head of the file states that the thread id was included because a close on a fd in a thread, in Linux, will result in the locks on all the other threads (of the same process) being released. The openCnt data structure seems to track the number of opens as well as locks held for a given file. So we were puzzled with regards to the function of the tid in the close issue. Can someone please explain how the purpose of the "tid" field in the lockKey structure and its relation to the close issue? Thanks a lot for the assistance, Regards, Sho.