diff options
author | Ulf Lilleengen <lulf@pvv.ntnu.no> | 2008-09-07 13:24:31 +0200 |
---|---|---|
committer | Ulf Lilleengen <lulf@pvv.ntnu.no> | 2008-09-07 13:24:31 +0200 |
commit | c74bd922870214c48ac5d032f13b0751ef32be59 (patch) | |
tree | 4482c8fc302a3fa35a8aed82e2e10c0b92584c8f /include | |
parent | 2cbb65112e9fb20a3532e0cf7b8ba49a44e0b024 (diff) |
- Fix serialization of debug printouts.
- Add a MFS_DB_LOCK/UNLOCK which handles locking of the SQLITE database if
SQLITE_THREADED compile option is not specified.
- Remove duplicate open/close of database during initial scan.
Diffstat (limited to 'include')
-rw-r--r-- | include/debug.h | 11 | ||||
-rw-r--r-- | include/musicfs.h | 2 |
2 files changed, 9 insertions, 4 deletions
diff --git a/include/debug.h b/include/debug.h index a30af63..350a27e 100644 --- a/include/debug.h +++ b/include/debug.h @@ -25,10 +25,15 @@ #ifdef DEBUGGING # include <stdio.h> # define DEBUGPATH "debug.txt" +extern pthread_mutex_t __debug_lock__; FILE *__debug_handle__; -# define DEBUG(...) __debug_handle__ = fopen(DEBUGPATH, "a"); \ - fprintf (__debug_handle__, __VA_ARGS__); \ - fclose(__debug_handle__); +# define DEBUG(...) do { \ + pthread_mutex_lock(&__debug_lock__); \ + __debug_handle__ = fopen(DEBUGPATH, "a"); \ + fprintf (__debug_handle__, __VA_ARGS__); \ + fclose(__debug_handle__); \ + pthread_mutex_unlock(&__debug_lock__); \ + } while (0) #else # define DEBUG(...) #endif diff --git a/include/musicfs.h b/include/musicfs.h index ca5d785..2a26880 100644 --- a/include/musicfs.h +++ b/include/musicfs.h @@ -23,7 +23,7 @@ struct fuse_args; int mfs_run(int, char **); -int mfs_initscan(); +int mfs_init(); /* |