summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2006-11-01 01:19:12 +0000
committerAlan Conway <aconway@apache.org>2006-11-01 01:19:12 +0000
commitdda71d21e76e01918ebec2d80dd8e077f94216e0 (patch)
tree79283c295e00de1eee8d98d4fd9b781db8497c28
parent9094d2b10ecadd66fa3b22169183e7573cc79629 (diff)
downloadqpid-python-dda71d21e76e01918ebec2d80dd8e077f94216e0.tar.gz
Moved APR specific sources into src_apr.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@469738 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--cpp/Makefile36
-rw-r--r--cpp/options.mk12
-rw-r--r--cpp/src/qpid/broker/Queue.cpp6
-rw-r--r--cpp/src/qpid/broker/Queue.h4
-rw-r--r--cpp/src/qpid/concurrent/Time.h52
-rw-r--r--cpp/src_apr/qpid/concurrent/APRBase.cpp (renamed from cpp/src/qpid/concurrent/APRBase.cpp)0
-rw-r--r--cpp/src_apr/qpid/concurrent/APRBase.h (renamed from cpp/src/qpid/concurrent/APRBase.h)0
-rw-r--r--cpp/src_apr/qpid/concurrent/Monitor.cpp (renamed from cpp/src/qpid/concurrent/Monitor.cpp)0
-rw-r--r--cpp/src_apr/qpid/concurrent/Monitor.h (renamed from cpp/src/qpid/concurrent/Monitor.h)0
-rw-r--r--cpp/src_apr/qpid/concurrent/Thread.cpp (renamed from cpp/src/qpid/concurrent/Thread.cpp)0
-rw-r--r--cpp/src_apr/qpid/concurrent/Thread.h (renamed from cpp/src/qpid/concurrent/Thread.h)0
-rw-r--r--cpp/src_apr/qpid/concurrent/ThreadFactory.cpp (renamed from cpp/src/qpid/concurrent/ThreadFactory.cpp)0
-rw-r--r--cpp/src_apr/qpid/concurrent/ThreadFactory.h (renamed from cpp/src/qpid/concurrent/ThreadFactory.h)0
-rw-r--r--cpp/src_apr/qpid/concurrent/ThreadPool.cpp (renamed from cpp/src/qpid/concurrent/ThreadPool.cpp)0
-rw-r--r--cpp/src_apr/qpid/concurrent/ThreadPool.h (renamed from cpp/src/qpid/concurrent/ThreadPool.h)0
-rw-r--r--cpp/src_apr/qpid/concurrent/Time.cpp29
-rw-r--r--cpp/src_apr/qpid/io/APRPool.cpp (renamed from cpp/src/qpid/io/APRPool.cpp)0
-rw-r--r--cpp/src_apr/qpid/io/APRPool.h (renamed from cpp/src/qpid/io/APRPool.h)0
-rw-r--r--cpp/src_apr/qpid/io/APRSocket.cpp (renamed from cpp/src/qpid/io/APRSocket.cpp)0
-rw-r--r--cpp/src_apr/qpid/io/APRSocket.h (renamed from cpp/src/qpid/io/APRSocket.h)0
-rw-r--r--cpp/src_apr/qpid/io/Acceptor.cpp (renamed from cpp/src/qpid/io/Acceptor.cpp)0
-rw-r--r--cpp/src_apr/qpid/io/Acceptor.h (renamed from cpp/src/qpid/io/Acceptor.h)0
-rw-r--r--cpp/src_apr/qpid/io/Connector.cpp (renamed from cpp/src/qpid/io/Connector.cpp)0
-rw-r--r--cpp/src_apr/qpid/io/Connector.h (renamed from cpp/src/qpid/io/Connector.h)0
-rw-r--r--cpp/src_apr/qpid/io/LFProcessor.cpp (renamed from cpp/src/qpid/io/LFProcessor.cpp)0
-rw-r--r--cpp/src_apr/qpid/io/LFProcessor.h (renamed from cpp/src/qpid/io/LFProcessor.h)0
-rw-r--r--cpp/src_apr/qpid/io/LFSessionContext.cpp (renamed from cpp/src/qpid/io/LFSessionContext.cpp)0
-rw-r--r--cpp/src_apr/qpid/io/LFSessionContext.h (renamed from cpp/src/qpid/io/LFSessionContext.h)0
28 files changed, 116 insertions, 23 deletions
diff --git a/cpp/Makefile b/cpp/Makefile
index e81e89a6a7..b3cd65f6d7 100644
--- a/cpp/Makefile
+++ b/cpp/Makefile
@@ -39,7 +39,12 @@ $(GENDIR)/timestamp: $(wildcard etc/stylesheets/*.xsl) $(SPEC)
rm -rf $(GENDIR)
mkdir -p $(GENDIR)/qpid/framing
( cd $(GENDIR)/qpid/framing && for s in $(STYLESHEETS) ; do $(TRANSFORM) $$s ; done ) && echo > $(GENDIR)/timestamp
-$(shell find $(GENDIR) -name *.cpp -o -name *.h): $(GENDIR)/timestamp
+
+# Dependencies for existing generated files.
+GENFILES:=$(wildcard $(GENDIR)/qpid/*/*.cpp $(GENDIR)/qpid/*/*.h)
+ifdef GENFILES
+$(GENFILES): $(GENDIR)/timestamp
+endif
$(BUILDDIRS):
mkdir -p $(BUILDDIRS)
@@ -47,15 +52,15 @@ $(BUILDDIRS):
## Library rules
LIB_common := $(call LIBFILE,common,1.0)
-$(LIB_common): $(call OBJ_FROM,src,qpid/concurrent qpid/framing qpid/io qpid) $(call OBJ_FROM,$(GENDIR),qpid/framing)
+$(LIB_common): $(call OBJECTS,qpid qpid/concurrent qpid/framing qpid/io)
$(LIB_COMMAND)
LIB_client :=$(call LIBFILE,client,1.0)
-$(LIB_client): $(call OBJ_FROM,src,qpid/client) $(LIB_common)
+$(LIB_client): $(call OBJECTS,qpid/client) $(LIB_common)
$(LIB_COMMAND)
LIB_broker :=$(call LIBFILE,broker,1.0)
-$(LIB_broker): $(call OBJ_FROM,src,qpid/broker) $(LIB_common)
+$(LIB_broker): $(call OBJECTS,qpid/broker) $(LIB_common)
$(LIB_COMMAND)
## Daemon executable
@@ -85,13 +90,14 @@ build/html: doxygen.cfg
## Implicit rules
-# C++ compiile
-$(OBJDIR)/%.o: src/%.cpp
- mkdir -p $(dir $@)
- $(CXX) $(CXXFLAGS) -c -o $@ $<
-$(OBJDIR)/%.o: $(GENDIR)/%.cpp
- mkdir -p $(dir $@)
- $(CXX) $(CXXFLAGS) -c -o $@ $<
+# C++ compile
+define CPPRULE
+$(OBJDIR)/%.o: $1/%.cpp
+ @mkdir -p $$(dir $$@)
+ $(CXX) $(CXXFLAGS) -c -o $$@ $$<
+endef
+
+$(foreach dir,$(SRCDIRS),$(eval $(call CPPRULE,$(dir))))
# Unit test plugin libraries.
$(TESTDIR)/%Test.so: test/unit/%Test.cpp
@@ -106,9 +112,11 @@ CLIENT_TEST_SRC := $(wildcard test/client/*.cpp)
CLIENT_TEST_EXE := $(CLIENT_TEST_SRC:test/client/%.cpp=$(TESTDIR)/%)
all-nogen: $(CLIENT_TEST_EXE)
-## #include dependencies
--include $(shell find $(GENDIR) $(OBJDIR) -name '*.d') dummy-avoid-warning-if-none
-
+## include dependencies
+DEPFILES:=$(wildcard $(OBJDIR)/*.d $(OBJDIR)/*/*.d $(OBJDIR)/*/*/*.d)
+ifdef DEPFILES
+-include $(DEPFILES)
+endif
## Clean up
diff --git a/cpp/options.mk b/cpp/options.mk
index fc9cd26fff..fec94c4fba 100644
--- a/cpp/options.mk
+++ b/cpp/options.mk
@@ -45,7 +45,8 @@ LIBDIR:=build/$(BUILD)/lib
OBJDIR:=build/$(BUILD)/obj
TESTDIR:=build/$(BUILD)/test
-BUILDDIRS:= $(BINDIR) $(LIBDIR) $(OBJDIR) $(TESTDIR) $(GENDIR)
+BUILDDIRS := $(BINDIR) $(LIBDIR) $(OBJDIR) $(TESTDIR) $(GENDIR)
+SRCDIRS := src src_$(PLATFORM) $(GENDIR)
## External dependencies:
@@ -68,14 +69,17 @@ RELEASE := -O3 -DNDEBUG
#
WARN := -Werror -pedantic -Wall -Wextra -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wno-long-long -Wvolatile-register-var -Winvalid-pch
-INCLUDES := -Isrc -I$(GENDIR) $(EXTRA_INCLUDES)
+INCLUDES := $(SRCDIRS:%=-I%) $(EXTRA_INCLUDES)
LDFLAGS := -L$(LIBDIR) $(LDFLAGS_$(PLATFORM))
CXXFLAGS := $(DEFINES) $(WARN) -MMD -fpic $(INCLUDES) $(CXXFLAGS_$(PLATFORM))
## Macros for linking, must be late evaluated
-# $(call OBJ_FROM,root,subdirs)
-OBJ_FROM = $(foreach sub,$2,$(patsubst $1/%.cpp,$(OBJDIR)/%.o,$(wildcard $1/$(sub)/*.cpp)))
+# Collect object files from a collection of src subdirs
+# $(call OBJ_FROM,srcdir,subdir)
+OBJECTS_1 = $(patsubst $1/$2/%.cpp,$(OBJDIR)/$2/%.o,$(wildcard $1/$2/*.cpp))
+OBJECTS = $(foreach src,$(SRCDIRS),$(foreach sub,$1,$(call OBJECTS_1,$(src),$(sub))))
+
# $(call LIBFILE,name,version)
LIBFILE =$(CURDIR)/$(LIBDIR)/libqpid_$1.so.$2
diff --git a/cpp/src/qpid/broker/Queue.cpp b/cpp/src/qpid/broker/Queue.cpp
index 88dad7aaf9..d671cea9a5 100644
--- a/cpp/src/qpid/broker/Queue.cpp
+++ b/cpp/src/qpid/broker/Queue.cpp
@@ -38,7 +38,7 @@ Queue::Queue(const string& _name, bool _durable, u_int32_t _autodelete,
lastUsed(0),
exclusive(0)
{
- if(autodelete) lastUsed = apr_time_as_msec(apr_time_now());
+ if(autodelete) lastUsed = Time::now().msecs();
}
Queue::~Queue(){
@@ -128,7 +128,7 @@ void Queue::consume(Consumer* c, bool requestExclusive){
void Queue::cancel(Consumer* c){
Locker locker(lock);
consumers.erase(find(consumers.begin(), consumers.end(), c));
- if(autodelete && consumers.empty()) lastUsed = apr_time_as_msec(apr_time_now());
+ if(autodelete && consumers.empty()) lastUsed = Time::now().msecs();
if(exclusive == c) exclusive = 0;
}
@@ -161,7 +161,7 @@ u_int32_t Queue::getConsumerCount() const{
bool Queue::canAutoDelete() const{
Locker locker(lock);
- return lastUsed && ((apr_time_as_msec(apr_time_now()) - lastUsed) > autodelete);
+ return lastUsed && (Time::now().msecs() - lastUsed > autodelete);
}
void Queue::enqueue(Message::shared_ptr& msg, const string * const xid){
diff --git a/cpp/src/qpid/broker/Queue.h b/cpp/src/qpid/broker/Queue.h
index f954e48c20..edc7c99b4f 100644
--- a/cpp/src/qpid/broker/Queue.h
+++ b/cpp/src/qpid/broker/Queue.h
@@ -21,13 +21,13 @@
#include <vector>
#include <queue>
#include <boost/shared_ptr.hpp>
-#include "apr-1/apr_time.h"
#include "qpid/framing/amqp_types.h"
#include "qpid/broker/Binding.h"
#include "qpid/broker/ConnectionToken.h"
#include "qpid/broker/Consumer.h"
#include "qpid/broker/Message.h"
#include "qpid/concurrent/Monitor.h"
+#include "qpid/concurrent/Time.h"
namespace qpid {
namespace broker {
@@ -57,7 +57,7 @@ namespace qpid {
bool dispatching;
int next;
mutable qpid::concurrent::Monitor lock;
- apr_time_t lastUsed;
+ int64_t lastUsed;
Consumer* exclusive;
bool startDispatching();
diff --git a/cpp/src/qpid/concurrent/Time.h b/cpp/src/qpid/concurrent/Time.h
new file mode 100644
index 0000000000..ec64ce8a85
--- /dev/null
+++ b/cpp/src/qpid/concurrent/Time.h
@@ -0,0 +1,52 @@
+#ifndef _concurrent_Time_h
+#define _concurrent_Time_h
+
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <stdint.h>
+
+namespace qpid {
+namespace concurrent {
+
+/**
+ * Time since the epoch.
+ */
+class Time
+{
+ public:
+ static const int64_t NANOS = 1000000000;
+ static const int64_t MICROS = 1000000;
+ static const int64_t MILLIS = 1000;
+
+ static Time now();
+
+ Time(int64_t nsecs_) : ticks(nsecs_) {}
+
+ int64_t nsecs() const { return ticks; }
+ int64_t usecs() const { return nsecs()/1000; }
+ int64_t msecs() const { return usecs()/1000; }
+ int64_t secs() const { return msecs()/1000; }
+
+ private:
+ int64_t ticks;
+};
+
+}}
+
+#endif /*!_concurrent_Time_h*/
diff --git a/cpp/src/qpid/concurrent/APRBase.cpp b/cpp/src_apr/qpid/concurrent/APRBase.cpp
index 514c4d1048..514c4d1048 100644
--- a/cpp/src/qpid/concurrent/APRBase.cpp
+++ b/cpp/src_apr/qpid/concurrent/APRBase.cpp
diff --git a/cpp/src/qpid/concurrent/APRBase.h b/cpp/src_apr/qpid/concurrent/APRBase.h
index f3ff0f89c1..f3ff0f89c1 100644
--- a/cpp/src/qpid/concurrent/APRBase.h
+++ b/cpp/src_apr/qpid/concurrent/APRBase.h
diff --git a/cpp/src/qpid/concurrent/Monitor.cpp b/cpp/src_apr/qpid/concurrent/Monitor.cpp
index ae68cf8751..ae68cf8751 100644
--- a/cpp/src/qpid/concurrent/Monitor.cpp
+++ b/cpp/src_apr/qpid/concurrent/Monitor.cpp
diff --git a/cpp/src/qpid/concurrent/Monitor.h b/cpp/src_apr/qpid/concurrent/Monitor.h
index a2777cb2f1..a2777cb2f1 100644
--- a/cpp/src/qpid/concurrent/Monitor.h
+++ b/cpp/src_apr/qpid/concurrent/Monitor.h
diff --git a/cpp/src/qpid/concurrent/Thread.cpp b/cpp/src_apr/qpid/concurrent/Thread.cpp
index 9bbc2f8131..9bbc2f8131 100644
--- a/cpp/src/qpid/concurrent/Thread.cpp
+++ b/cpp/src_apr/qpid/concurrent/Thread.cpp
diff --git a/cpp/src/qpid/concurrent/Thread.h b/cpp/src_apr/qpid/concurrent/Thread.h
index d18bc153bf..d18bc153bf 100644
--- a/cpp/src/qpid/concurrent/Thread.h
+++ b/cpp/src_apr/qpid/concurrent/Thread.h
diff --git a/cpp/src/qpid/concurrent/ThreadFactory.cpp b/cpp/src_apr/qpid/concurrent/ThreadFactory.cpp
index b20f9f2b04..b20f9f2b04 100644
--- a/cpp/src/qpid/concurrent/ThreadFactory.cpp
+++ b/cpp/src_apr/qpid/concurrent/ThreadFactory.cpp
diff --git a/cpp/src/qpid/concurrent/ThreadFactory.h b/cpp/src_apr/qpid/concurrent/ThreadFactory.h
index 572419cae6..572419cae6 100644
--- a/cpp/src/qpid/concurrent/ThreadFactory.h
+++ b/cpp/src_apr/qpid/concurrent/ThreadFactory.h
diff --git a/cpp/src/qpid/concurrent/ThreadPool.cpp b/cpp/src_apr/qpid/concurrent/ThreadPool.cpp
index 5da19745a7..5da19745a7 100644
--- a/cpp/src/qpid/concurrent/ThreadPool.cpp
+++ b/cpp/src_apr/qpid/concurrent/ThreadPool.cpp
diff --git a/cpp/src/qpid/concurrent/ThreadPool.h b/cpp/src_apr/qpid/concurrent/ThreadPool.h
index 11f0cc364f..11f0cc364f 100644
--- a/cpp/src/qpid/concurrent/ThreadPool.h
+++ b/cpp/src_apr/qpid/concurrent/ThreadPool.h
diff --git a/cpp/src_apr/qpid/concurrent/Time.cpp b/cpp/src_apr/qpid/concurrent/Time.cpp
new file mode 100644
index 0000000000..19f1f30140
--- /dev/null
+++ b/cpp/src_apr/qpid/concurrent/Time.cpp
@@ -0,0 +1,29 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#include <qpid/concurrent/Time.h>
+#include <apr-1/apr_time.h>
+
+namespace qpid {
+namespace concurrent {
+
+Time Time::now() {
+ return Time(apr_time_now()*1000);
+}
+
+}}
diff --git a/cpp/src/qpid/io/APRPool.cpp b/cpp/src_apr/qpid/io/APRPool.cpp
index edd434f16c..edd434f16c 100644
--- a/cpp/src/qpid/io/APRPool.cpp
+++ b/cpp/src_apr/qpid/io/APRPool.cpp
diff --git a/cpp/src/qpid/io/APRPool.h b/cpp/src_apr/qpid/io/APRPool.h
index 063eedf1ee..063eedf1ee 100644
--- a/cpp/src/qpid/io/APRPool.h
+++ b/cpp/src_apr/qpid/io/APRPool.h
diff --git a/cpp/src/qpid/io/APRSocket.cpp b/cpp/src_apr/qpid/io/APRSocket.cpp
index 824c376c3b..824c376c3b 100644
--- a/cpp/src/qpid/io/APRSocket.cpp
+++ b/cpp/src_apr/qpid/io/APRSocket.cpp
diff --git a/cpp/src/qpid/io/APRSocket.h b/cpp/src_apr/qpid/io/APRSocket.h
index 0b6644dfb6..0b6644dfb6 100644
--- a/cpp/src/qpid/io/APRSocket.h
+++ b/cpp/src_apr/qpid/io/APRSocket.h
diff --git a/cpp/src/qpid/io/Acceptor.cpp b/cpp/src_apr/qpid/io/Acceptor.cpp
index f95d9448cf..f95d9448cf 100644
--- a/cpp/src/qpid/io/Acceptor.cpp
+++ b/cpp/src_apr/qpid/io/Acceptor.cpp
diff --git a/cpp/src/qpid/io/Acceptor.h b/cpp/src_apr/qpid/io/Acceptor.h
index bc189f7f6e..bc189f7f6e 100644
--- a/cpp/src/qpid/io/Acceptor.h
+++ b/cpp/src_apr/qpid/io/Acceptor.h
diff --git a/cpp/src/qpid/io/Connector.cpp b/cpp/src_apr/qpid/io/Connector.cpp
index ca487deb86..ca487deb86 100644
--- a/cpp/src/qpid/io/Connector.cpp
+++ b/cpp/src_apr/qpid/io/Connector.cpp
diff --git a/cpp/src/qpid/io/Connector.h b/cpp/src_apr/qpid/io/Connector.h
index 7c52f7e87b..7c52f7e87b 100644
--- a/cpp/src/qpid/io/Connector.h
+++ b/cpp/src_apr/qpid/io/Connector.h
diff --git a/cpp/src/qpid/io/LFProcessor.cpp b/cpp/src_apr/qpid/io/LFProcessor.cpp
index dabbdbecae..dabbdbecae 100644
--- a/cpp/src/qpid/io/LFProcessor.cpp
+++ b/cpp/src_apr/qpid/io/LFProcessor.cpp
diff --git a/cpp/src/qpid/io/LFProcessor.h b/cpp/src_apr/qpid/io/LFProcessor.h
index 5b61f444af..5b61f444af 100644
--- a/cpp/src/qpid/io/LFProcessor.h
+++ b/cpp/src_apr/qpid/io/LFProcessor.h
diff --git a/cpp/src/qpid/io/LFSessionContext.cpp b/cpp/src_apr/qpid/io/LFSessionContext.cpp
index ca1e6431a6..ca1e6431a6 100644
--- a/cpp/src/qpid/io/LFSessionContext.cpp
+++ b/cpp/src_apr/qpid/io/LFSessionContext.cpp
diff --git a/cpp/src/qpid/io/LFSessionContext.h b/cpp/src_apr/qpid/io/LFSessionContext.h
index 8d30b54204..8d30b54204 100644
--- a/cpp/src/qpid/io/LFSessionContext.h
+++ b/cpp/src_apr/qpid/io/LFSessionContext.h