Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2014-07-05 02:02:45 -0400
committerEugene Tarassov2014-07-05 02:02:45 -0400
commit921d199bc5f28e3c62c93aed16876c20ac840e7a (patch)
tree9f122ea9131f0a9dc036849120c26fb8cde74b26
parentd4cd3a67ecefb54b82cd8434fb1ba37b8ab31752 (diff)
downloadorg.eclipse.tcf.agent-921d199bc5f28e3c62c93aed16876c20ac840e7a.tar.gz
org.eclipse.tcf.agent-921d199bc5f28e3c62c93aed16876c20ac840e7a.tar.xz
org.eclipse.tcf.agent-921d199bc5f28e3c62c93aed16876c20ac840e7a.zip
TCF Agent: fixed: if no current cache transaction, cache_transaction_id() should return 0, cache_channel() should return NULL
-rw-r--r--agent/tcf/framework/cache.c7
-rw-r--r--agent/tcf/framework/cache.h1
2 files changed, 6 insertions, 2 deletions
diff --git a/agent/tcf/framework/cache.c b/agent/tcf/framework/cache.c
index 74d37c1e..836d1e2f 100644
--- a/agent/tcf/framework/cache.c
+++ b/agent/tcf/framework/cache.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2013 Wind River Systems, Inc. and others.
+ * Copyright (c) 2009, 2014 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* and Eclipse Distribution License v1.0 which accompany this distribution.
@@ -108,8 +108,10 @@ static void run_cache_client(void) {
void cache_enter(CacheClient * client, Channel * channel, void * args, size_t args_size) {
assert(is_dispatch_thread());
assert(client != NULL);
+ assert(current_client.id == 0);
assert(current_client.client == NULL);
current_client.id = id_cnt++;
+ if (current_client.id == 0) current_client.id = id_cnt++;
current_client.client = client;
current_client.channel = channel;
current_client.args = args;
@@ -218,7 +220,8 @@ void cache_notify_later(AbstractCache * cache) {
Channel * cache_channel(void) {
if (current_client.channel != NULL) return current_client.channel;
- return def_channel;
+ if (current_client.client != NULL) return def_channel;
+ return NULL;
}
void cache_set_def_channel(Channel * channel) {
diff --git a/agent/tcf/framework/cache.h b/agent/tcf/framework/cache.h
index f257608d..7ba5c35b 100644
--- a/agent/tcf/framework/cache.h
+++ b/agent/tcf/framework/cache.h
@@ -162,6 +162,7 @@ extern void cache_set_def_channel(Channel * channel);
/*
* Return unique ID of current cache client transaction.
+ * Return 0 if there is no current transaction.
*/
extern unsigned cache_transaction_id(void);

Back to the top