You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2006/11/01 02:19:14 UTC
svn commit: r469738 - in /incubator/qpid/trunk/qpid/cpp: ./ src/qpid/broker/
src/qpid/concurrent/ src/qpid/io/ src_apr/ src_apr/qpid/
src_apr/qpid/concurrent/ src_apr/qpid/io/
Author: aconway
Date: Tue Oct 31 17:19:12 2006
New Revision: 469738
URL: http://svn.apache.org/viewvc?view=rev&rev=469738
Log:
Moved APR specific sources into src_apr.
Added:
incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Time.h (with props)
incubator/qpid/trunk/qpid/cpp/src_apr/
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/APRBase.cpp
- copied unchanged from r469604, incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/APRBase.cpp
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/APRBase.h
- copied unchanged from r469604, incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/APRBase.h
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/Monitor.cpp
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Monitor.cpp
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/Monitor.h
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Monitor.h
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/Thread.cpp
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Thread.cpp
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/Thread.h
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Thread.h
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/ThreadFactory.cpp
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/ThreadFactory.cpp
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/ThreadFactory.h
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/ThreadFactory.h
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/ThreadPool.cpp
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/ThreadPool.cpp
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/ThreadPool.h
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/ThreadPool.h
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/Time.cpp (with props)
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/APRPool.cpp
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/io/APRPool.cpp
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/APRPool.h
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/io/APRPool.h
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/APRSocket.cpp
- copied unchanged from r469610, incubator/qpid/trunk/qpid/cpp/src/qpid/io/APRSocket.cpp
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/APRSocket.h
- copied unchanged from r469610, incubator/qpid/trunk/qpid/cpp/src/qpid/io/APRSocket.h
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/Acceptor.cpp
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/io/Acceptor.cpp
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/Acceptor.h
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/io/Acceptor.h
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/Connector.cpp
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/io/Connector.cpp
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/Connector.h
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/io/Connector.h
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/LFProcessor.cpp
- copied unchanged from r469610, incubator/qpid/trunk/qpid/cpp/src/qpid/io/LFProcessor.cpp
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/LFProcessor.h
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/io/LFProcessor.h
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/LFSessionContext.cpp
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/io/LFSessionContext.cpp
incubator/qpid/trunk/qpid/cpp/src_apr/qpid/io/LFSessionContext.h
- copied unchanged from r469625, incubator/qpid/trunk/qpid/cpp/src/qpid/io/LFSessionContext.h
Removed:
incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/APRBase.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/APRBase.h
incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Monitor.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Monitor.h
incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Thread.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Thread.h
incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/ThreadFactory.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/ThreadFactory.h
incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/ThreadPool.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/ThreadPool.h
incubator/qpid/trunk/qpid/cpp/src/qpid/io/APRPool.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/io/APRPool.h
incubator/qpid/trunk/qpid/cpp/src/qpid/io/APRSocket.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/io/APRSocket.h
incubator/qpid/trunk/qpid/cpp/src/qpid/io/Acceptor.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/io/Acceptor.h
incubator/qpid/trunk/qpid/cpp/src/qpid/io/Connector.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/io/Connector.h
incubator/qpid/trunk/qpid/cpp/src/qpid/io/LFProcessor.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/io/LFProcessor.h
incubator/qpid/trunk/qpid/cpp/src/qpid/io/LFSessionContext.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/io/LFSessionContext.h
Modified:
incubator/qpid/trunk/qpid/cpp/ (props changed)
incubator/qpid/trunk/qpid/cpp/Makefile
incubator/qpid/trunk/qpid/cpp/options.mk
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h
Propchange: incubator/qpid/trunk/qpid/cpp/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Tue Oct 31 17:19:12 2006
@@ -1,2 +1,3 @@
qpidd.log
gen
+build
Modified: incubator/qpid/trunk/qpid/cpp/Makefile
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/Makefile?view=diff&rev=469738&r1=469737&r2=469738
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/Makefile (original)
+++ incubator/qpid/trunk/qpid/cpp/Makefile Tue Oct 31 17:19:12 2006
@@ -39,7 +39,12 @@
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 @@
## 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 @@
## 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_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
Modified: incubator/qpid/trunk/qpid/cpp/options.mk
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/options.mk?view=diff&rev=469738&r1=469737&r2=469738
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/options.mk (original)
+++ incubator/qpid/trunk/qpid/cpp/options.mk Tue Oct 31 17:19:12 2006
@@ -45,7 +45,8 @@
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 @@
#
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
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp?view=diff&rev=469738&r1=469737&r2=469738
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.cpp Tue Oct 31 17:19:12 2006
@@ -38,7 +38,7 @@
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::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 @@
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){
Modified: incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h?view=diff&rev=469738&r1=469737&r2=469738
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h (original)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/broker/Queue.h Tue Oct 31 17:19:12 2006
@@ -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 @@
bool dispatching;
int next;
mutable qpid::concurrent::Monitor lock;
- apr_time_t lastUsed;
+ int64_t lastUsed;
Consumer* exclusive;
bool startDispatching();
Added: incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Time.h
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Time.h?view=auto&rev=469738
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Time.h (added)
+++ incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Time.h Tue Oct 31 17:19:12 2006
@@ -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*/
Propchange: incubator/qpid/trunk/qpid/cpp/src/qpid/concurrent/Time.h
------------------------------------------------------------------------------
svn:eol-style = native
Added: incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/Time.cpp
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/Time.cpp?view=auto&rev=469738
==============================================================================
--- incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/Time.cpp (added)
+++ incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/Time.cpp Tue Oct 31 17:19:12 2006
@@ -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);
+}
+
+}}
Propchange: incubator/qpid/trunk/qpid/cpp/src_apr/qpid/concurrent/Time.cpp
------------------------------------------------------------------------------
svn:eol-style = native