trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vmam...@apache.org
Subject svn commit: r939449 - in /incubator/trafficserver/traffic/trunk/iocore: eventsystem/I_EventProcessor.h eventsystem/I_ProtectedQueue.h eventsystem/P_UnixEventProcessor.h eventsystem/ProtectedQueue.cc net/UnixNet.cc net/UnixNetAccept.cc
Date Thu, 29 Apr 2010 18:51:16 GMT
Author: vmamidi
Date: Thu Apr 29 18:51:16 2010
New Revision: 939449

URL: http://svn.apache.org/viewvc?rev=939449&view=rev
Log:
TS-329 -- fix the pipe based signaling

Modified:
    incubator/trafficserver/traffic/trunk/iocore/eventsystem/I_EventProcessor.h
    incubator/trafficserver/traffic/trunk/iocore/eventsystem/I_ProtectedQueue.h
    incubator/trafficserver/traffic/trunk/iocore/eventsystem/P_UnixEventProcessor.h
    incubator/trafficserver/traffic/trunk/iocore/eventsystem/ProtectedQueue.cc
    incubator/trafficserver/traffic/trunk/iocore/net/UnixNet.cc
    incubator/trafficserver/traffic/trunk/iocore/net/UnixNetAccept.cc

Modified: incubator/trafficserver/traffic/trunk/iocore/eventsystem/I_EventProcessor.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/iocore/eventsystem/I_EventProcessor.h?rev=939449&r1=939448&r2=939449&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/iocore/eventsystem/I_EventProcessor.h (original)
+++ incubator/trafficserver/traffic/trunk/iocore/eventsystem/I_EventProcessor.h Thu Apr 29
18:51:16 2010
@@ -143,7 +143,11 @@ public:
   */
   Event *schedule_imm(Continuation * c,
                       EventType event_type = ET_CALL, int callback_event = EVENT_IMMEDIATE,
void *cookie = NULL);
-
+  /* 
+    provides the same functionality as schedule_imm and also signals the thread immediately
+  */
+  Event *schedule_imm_signal(Continuation * c,
+                      EventType event_type = ET_CALL, int callback_event = EVENT_IMMEDIATE,
void *cookie = NULL);
   /**
     Schedules the continuation on a specific thread group to receive an
     event at the given timeout. Requests the EventProcessor to schedule
@@ -304,7 +308,7 @@ public:
   | Unix & non NT Interface                                |
   \*------------------------------------------------------*/
 
-  Event * schedule(Event * e, EventType etype);
+  Event * schedule(Event * e, EventType etype, bool fast_signal = false);
   EThread *assign_thread(EventType etype);
 
   EThread *dthreads[MAX_EVENT_THREADS];

Modified: incubator/trafficserver/traffic/trunk/iocore/eventsystem/I_ProtectedQueue.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/iocore/eventsystem/I_ProtectedQueue.h?rev=939449&r1=939448&r2=939449&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/iocore/eventsystem/I_ProtectedQueue.h (original)
+++ incubator/trafficserver/traffic/trunk/iocore/eventsystem/I_ProtectedQueue.h Thu Apr 29
18:51:16 2010
@@ -37,10 +37,9 @@
 
 #include "inktomi++.h"
 #include "I_Event.h"
-
 struct ProtectedQueue
 {
-  void enqueue(Event * e);
+  void enqueue(Event * e,bool fast_signal=false);
   void signal();
   int try_signal();             // Use non blocking lock and if acquired, signal
   void enqueue_local(Event * e);        // Safe when called from the same thread

Modified: incubator/trafficserver/traffic/trunk/iocore/eventsystem/P_UnixEventProcessor.h
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/iocore/eventsystem/P_UnixEventProcessor.h?rev=939449&r1=939448&r2=939449&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/iocore/eventsystem/P_UnixEventProcessor.h (original)
+++ incubator/trafficserver/traffic/trunk/iocore/eventsystem/P_UnixEventProcessor.h Thu Apr
29 18:51:16 2010
@@ -70,14 +70,14 @@ EventProcessor::assign_thread(EventType 
 }
 
 TS_INLINE Event *
-EventProcessor::schedule(Event * e, EventType etype)
+EventProcessor::schedule(Event * e, EventType etype, bool fast_signal)
 {
   e->ethread = assign_thread(etype);
   if (e->continuation->mutex)
     e->mutex = e->continuation->mutex;
   else
     e->mutex = e->continuation->mutex = e->ethread->mutex;
-  e->ethread->EventQueueExternal.enqueue(e);
+  e->ethread->EventQueueExternal.enqueue(e,fast_signal);
   return e;
 }
 
@@ -92,6 +92,18 @@ EventProcessor::schedule_spawn(Continuat
 #endif
 
 TS_INLINE Event *
+EventProcessor::schedule_imm_signal(Continuation * cont, EventType et, int callback_event,
void *cookie)
+{
+  Event *e = eventAllocator.alloc();
+#ifdef ENABLE_TIME_TRACE
+  e->start_time = ink_get_hrtime();
+#endif
+  e->callback_event = callback_event;
+  e->cookie = cookie;
+  return schedule(e->init(cont, 0, 0), et,true);
+}
+
+TS_INLINE Event *
 EventProcessor::schedule_imm(Continuation * cont, EventType et, int callback_event, void
*cookie)
 {
   Event *e = eventAllocator.alloc();

Modified: incubator/trafficserver/traffic/trunk/iocore/eventsystem/ProtectedQueue.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/iocore/eventsystem/ProtectedQueue.cc?rev=939449&r1=939448&r2=939449&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/iocore/eventsystem/ProtectedQueue.cc (original)
+++ incubator/trafficserver/traffic/trunk/iocore/eventsystem/ProtectedQueue.cc Thu Apr 29
18:51:16 2010
@@ -45,7 +45,7 @@
 extern ClassAllocator<Event> eventAllocator;
 
 void
-ProtectedQueue::enqueue(Event * e)
+ProtectedQueue::enqueue(Event * e , bool fast_signal)
 {
   ink_assert(!e->in_the_prot_queue && !e->in_the_priority_queue);
   EThread *e_ethread = e->ethread;
@@ -59,6 +59,10 @@ ProtectedQueue::enqueue(Event * e)
     if (inserting_thread != e_ethread) {
       if (!inserting_thread || !inserting_thread->ethreads_to_be_signalled) {
         signal();
+        if (fast_signal) { 
+          if (e_ethread->signal_hook)
+            e_ethread->signal_hook(e_ethread);
+        }
       } else {
 
 #ifdef EAGER_SIGNALLING
@@ -66,7 +70,11 @@ ProtectedQueue::enqueue(Event * e)
         if (e_ethread->EventQueueExternal.try_signal())
           return;
 #endif
-
+        
+        if (fast_signal) { 
+          if (e_ethread->signal_hook)
+            e_ethread->signal_hook(e_ethread);
+        }
         int &t = inserting_thread->n_ethreads_to_be_signalled;
         EThread **sig_e = inserting_thread->ethreads_to_be_signalled;
         if ((t + 1) >= eventProcessor.n_ethreads) {

Modified: incubator/trafficserver/traffic/trunk/iocore/net/UnixNet.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/iocore/net/UnixNet.cc?rev=939449&r1=939448&r2=939449&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/iocore/net/UnixNet.cc (original)
+++ incubator/trafficserver/traffic/trunk/iocore/net/UnixNet.cc Thu Apr 29 18:51:16 2010
@@ -185,7 +185,7 @@ net_signal_hook_function(EThread *thread
   NOWARN_UNUSED_RETURN(write(thread->evfd, &counter, sizeof(inku64)));
 #else
   char dummy;
-  NOWARN_UNUSED_RETURN(write(thread->evpipe[0], &dummy, 1));
+  NOWARN_UNUSED_RETURN(write(thread->evpipe[1], &dummy, 1));
 #endif  
 }
 

Modified: incubator/trafficserver/traffic/trunk/iocore/net/UnixNetAccept.cc
URL: http://svn.apache.org/viewvc/incubator/trafficserver/traffic/trunk/iocore/net/UnixNetAccept.cc?rev=939449&r1=939448&r2=939449&view=diff
==============================================================================
--- incubator/trafficserver/traffic/trunk/iocore/net/UnixNetAccept.cc (original)
+++ incubator/trafficserver/traffic/trunk/iocore/net/UnixNetAccept.cc Thu Apr 29 18:51:16
2010
@@ -338,7 +338,8 @@ NetAccept::do_blocking_accept(NetAccept 
     vc->mutex = new_ProxyMutex();
     vc->action_ = *action_;
     SET_CONTINUATION_HANDLER(vc, (NetVConnHandler) & UnixNetVConnection::acceptEvent);
-    eventProcessor.schedule_imm(vc, getEtype());
+    //eventProcessor.schedule_imm(vc, getEtype());
+    eventProcessor.schedule_imm_signal(vc, getEtype());
   } while (loop);
 
   return 1;



Mime
View raw message