async2->op = STORE_OP_PUT;
async2->key = g_strdup(async->key);
async2->data = record->data;
+ async2->profile = async->profile;
bluesky_string_ref(record->data);
bluesky_store_async_submit(async2);
bluesky_store_async_add_notifier(async2,
async->key = g_strdup(cachefile->filename);
async->start = offset;
async->len = length;
+ async->profile = bluesky_profile_get();
bluesky_store_async_add_notifier(async,
(GFunc)cloudlog_partial_fetch_complete,
cachefile);
BlueSkyStoreAsync *async = bluesky_store_async_new(cachefile->fs->store);
async->op = STORE_OP_GET;
async->key = g_strdup(cachefile->filename);
+ async->profile = bluesky_profile_get();
bluesky_store_async_add_notifier(async,
(GFunc)cloudlog_partial_fetch_complete,
cachefile);
char *message;
} RTEvent;
+/* To catch attempts to access to invalid profile structures. */
+#define PROFILE_MAGIC 0x439929d8
+
BlueSkyProfile *bluesky_profile_new()
{
BlueSkyProfile *profile = g_new0(BlueSkyProfile, 1);
profile->lock = g_mutex_new();
+ profile->magic = PROFILE_MAGIC;
return profile;
}
void bluesky_profile_free(BlueSkyProfile *profile)
{
+ if (profile->magic != PROFILE_MAGIC) {
+ g_warning("Access to invalid BlueSkyProfile object!");
+ return;
+ }
while (profile->events != NULL) {
RTEvent *event = (RTEvent *)profile->events->data;
g_free(event->message);
g_free(event);
profile->events = g_list_delete_link(profile->events, profile->events);
}
+ profile->magic = 0;
g_mutex_free(profile->lock);
g_free(profile->description);
g_free(profile);
{
g_return_if_fail(profile != NULL);
+ if (profile->magic != PROFILE_MAGIC) {
+ g_warning("Access to invalid BlueSkyProfile object!");
+ return;
+ }
g_mutex_lock(profile->lock);
RTEvent *event = g_new(RTEvent, 1);
event->timestamp = bluesky_now_hires();
g_return_if_fail(profile != NULL);
+ if (profile->magic != PROFILE_MAGIC) {
+ g_warning("Access to invalid BlueSkyProfile object!");
+ return;
+ }
+
g_mutex_lock(profile->lock);
g_static_mutex_lock(&profiling_print_lock);
fprintf(stream, "Event Timeline: %s\n", profile->description);