This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Signal handling


On Thursday, 4. July 2002 11:40, Basheer Ahmed Anwar Basha Muddebihal wrote:
> Hi Ronald
>
> I want to know Which part of the file you have changed
>

I have put the patch as attachment.

Roland
Index: net/snmp/agent/current/src/snmptask.c
===================================================================
RCS file: /cvs/ecos/ecos-opt/snmp/agent/current/src/snmptask.c,v
retrieving revision 1.5
diff -u -5 -p -r1.5 snmptask.c
--- net/snmp/agent/current/src/snmptask.c	23 May 2002 23:08:10 -0000	1.5
+++ net/snmp/agent/current/src/snmptask.c	4 Jul 2002 09:47:59 -0000
@@ -172,48 +172,79 @@ CONNECTION WITH THE USE OR PERFORMANCE O
 
 
 
 #define STACK_SIZE CYGNUM_HAL_STACK_SIZE_TYPICAL + 102400
 static char netsnmp_stack[STACK_SIZE];
-static cyg_thread netsnmp_thread_data;
-static cyg_handle_t netsnmp_thread_handle;
-
 
+#ifdef CYGPKG_POSIX_MAIN_THREAD
+#include <pthread.h>
 
+static pthread_t netsnmp_thread;
+#else
+static cyg_thread netsnmp_thread_data;
+static cyg_handle_t netsnmp_thread_handle;
+#endif
 
 externC void (*snmpd_reinit_function)( void );
 
 void (*snmpd_reinit_function)( void ) = NULL;
 
 
 externC void snmpd( void (*initfunc)( void ) );
 
+#ifdef CYGPKG_POSIX_MAIN_THREAD
+static void*
+snmpdloop( void *data )
+{
+    while ( 1 )
+        snmpd(snmpd_reinit_function);
+} 
+#else
 static void
-snmpdloop( void )
+snmpdloop( cyg_addrword_t data )
 {
     while ( 1 )
         snmpd(snmpd_reinit_function);
 } 
+#endif
 
 // Network initialization
 //   This function is called during system initialization to setup the whole
 // networking environment.
 //
 
 void
 cyg_net_snmp_init(void)
 {
+#ifdef CYGPKG_POSIX_MAIN_THREAD
+    // Create the main thread
+    pthread_attr_t attr;
+    struct sched_param schedparam;
+
+    schedparam.sched_priority = CYGPKG_NET_THREAD_PRIORITY+1;
+
+    pthread_attr_init( &attr );
+    pthread_attr_setinheritsched( &attr, PTHREAD_EXPLICIT_SCHED );
+    pthread_attr_setstackaddr( &attr, &netsnmp_stack[STACK_SIZE] );
+    pthread_attr_setstacksize( &attr, sizeof(netsnmp_stack) );
+    pthread_attr_setschedpolicy( &attr, SCHED_RR );
+    pthread_attr_setschedparam( &attr, &schedparam );
+
+    pthread_create( &netsnmp_thread, &attr, snmpdloop, NULL );
+
+#else
 
     // Create network background thread
     cyg_thread_create(CYGPKG_NET_THREAD_PRIORITY+1, // Priority, just lower than the net
                       snmpdloop,                // entry
-                      0,                        // entry parameter
+                      0,                     // entry parameter
                       "snmpd",                  // Name
                       &netsnmp_stack[0],        // Stack
                       STACK_SIZE,               // Size
                       &netsnmp_thread_handle,   // Handle
                       &netsnmp_thread_data      // Thread data structure
             );
     cyg_thread_resume(netsnmp_thread_handle);    // Start it
     // Done
 
+#endif
 }
-- 
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]