Add a prolog and epilog for safe reading of the metadata bundle
This commit is contained in:
@@ -130,6 +130,18 @@ void metadata_hub_modify_epilog(int modified) {
|
||||
}
|
||||
}
|
||||
|
||||
void metadata_hub_read_prolog(void) {
|
||||
// always run this before reading an entry or a sequence of entries in the metadata_hub
|
||||
// debug(1, "locking metadata hub for reading");
|
||||
pthread_rwlock_rdlock(&metadata_hub_re_lock);
|
||||
}
|
||||
|
||||
void metadata_hub_read_epilog(void) {
|
||||
// always run this after reading an entry or a sequence of entries in the metadata_hub
|
||||
// debug(1, "unlocking metadata hub for reading");
|
||||
pthread_rwlock_unlock(&metadata_hub_re_lock);
|
||||
}
|
||||
|
||||
char *metadata_write_image_file(const char *buf, int len) {
|
||||
|
||||
// warning -- this removes all files from the directory apart from this one, if it exists
|
||||
|
||||
+5
-1
@@ -87,7 +87,7 @@ typedef struct metadata_bundle {
|
||||
|
||||
int speaker_volume; // this is the actual speaker volume, allowing for the main volume and the
|
||||
// speaker volume control
|
||||
int previous_speaker_volume; // this is needed to prevent a loop
|
||||
// int previous_speaker_volume; // this is needed to prevent a loop
|
||||
|
||||
metadata_watcher watchers[number_of_watchers]; // functions to call if the metadata is changed.
|
||||
void *watchers_data[number_of_watchers]; // their individual data
|
||||
@@ -107,3 +107,7 @@ void metadata_hub_release_track_artwork(void);
|
||||
// afterwards
|
||||
void metadata_hub_modify_prolog(void);
|
||||
void metadata_hub_modify_epilog(int modified); // set to true if modifications occured, 0 otherwise
|
||||
|
||||
// these are for safe reading
|
||||
void metadata_hub_read_prolog(void);
|
||||
void metadata_hub_read_epilog(void);
|
||||
|
||||
Reference in New Issue
Block a user