[prev in list] [next in list] [prev in thread] [next in thread] 

List:       privoxy-commits
Subject:    [privoxy-commits] current jcc.c,1.466,1.467
From:       Fabian Keil via ijbswa-commits <ijbswa-commits () lists ! sourceforge ! net>
Date:       2017-06-26 12:18:23
Message-ID: E1dPSyG-0000lO-UY () sfs-ml-1 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

Update of /cvsroot/ijbswa/current
In directory sfp-cvs-1.v30.ch3.sourceforge.com:/tmp/cvs-serv22160

Modified Files:
	jcc.c 
Log Message:
listen_loop(): Reuse a single thread attribute object

The object doesn't change and creating a new one for
every thread is a waste of (cpu) time.

Sponsored by: Robert Klemme


Index: jcc.c
===================================================================
RCS file: /cvsroot/ijbswa/current/jcc.c,v
retrieving revision 1.466
retrieving revision 1.467
diff -C2 -d -r1.466 -r1.467
*** jcc.c	26 Jun 2017 12:17:57 -0000	1.466
--- jcc.c	26 Jun 2017 12:18:21 -0000	1.467
***************
*** 4297,4300 ****
--- 4297,4306 ----
     struct configuration_spec *config;
     unsigned int active_threads = 0;
+ #if defined(FEATURE_PTHREAD)
+    pthread_attr_t attrs;
+ 
+    pthread_attr_init(&attrs);
+    pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
+ #endif
  
     config = load_config();
***************
*** 4452,4463 ****
           {
              pthread_t the_thread;
-             pthread_attr_t attrs;
  
-             pthread_attr_init(&attrs);
-             pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
              errno = pthread_create(&the_thread, &attrs,
                 (void * (*)(void *))serve, csp);
              child_id = errno ? -1 : 0;
-             pthread_attr_destroy(&attrs);
           }
  #endif
--- 4458,4465 ----
***************
*** 4624,4627 ****
--- 4626,4633 ----
     }
  
+ #if defined(FEATURE_PTHREAD)
+    pthread_attr_destroy(&attrs);
+ #endif
+ 
     /* NOTREACHED unless FEATURE_GRACEFUL_TERMINATION is defined */
  


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
ijbswa-commits mailing list
ijbswa-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ijbswa-commits
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic