Check-in [1fb0b13c23]
Overview
Comment:Updated to use nanosleep() instead of usleep() which requires a _BSD_SOURCE macro
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:1fb0b13c23efd52a61931663193668827c9867f2
User & Date: rkeene on 2016-09-22 18:34:17
Other Links: manifest | tags
Context
2016-09-22
19:02
Updated to support compiling filed in alternate directories check-in: 08602df0fc user: rkeene tags: trunk
18:34
Updated to use nanosleep() instead of usleep() which requires a _BSD_SOURCE macro check-in: 1fb0b13c23 user: rkeene tags: trunk
18:01
Updated to explicitly use sigaction and BSD-style signal handlers, needed to properly deal with SIGPIPE when closing connections check-in: 3a7004a8cd user: rkeene tags: trunk
Changes

Modified filed.c from [ca95c3f44a] to [34dea9bf8d].

   713    713   
   714    714   	atomic_store(&filed_sockettimeout_sockstatus[sockfd].valid, false);
   715    715   
   716    716   	return;
   717    717   }
   718    718   
   719    719   static void *filed_sockettimeout_thread(void *arg) {
          720  +	struct timespec sleep_time;
   720    721   	time_t now, expiration_time;
   721    722   	pthread_t thread_id;
   722    723   	long idx;
   723    724   	int count;
   724    725   	bool valid;
   725    726   
   726    727   	while (1) {
   727    728   		for (count = 0; count < 10; count++) {
   728         -			usleep(30000000);
          729  +			sleep_time.tv_sec = 30;
          730  +			sleep_time.tv_nsec = 0;
          731  +			nanosleep(&sleep_time, NULL);
   729    732   
   730    733   			now = time(NULL);
   731    734   
   732    735   			atomic_store(&filed_sockettimeout_time, now);
   733    736   		}
   734    737   
   735    738   		for (idx = 0; idx < filed_sockettimeout_sockstatus_length; idx++) {
................................................................................
  1911   1914   
  1912   1915   		return(5);
  1913   1916   	}
  1914   1917   
  1915   1918   	/* Wait for threads to exit */
  1916   1919   	/* XXX:TODO: Monitor thread usage */
  1917   1920   	while (1) {
  1918         -		sleep(60);
         1921  +		sleep(86400);
  1919   1922   	}
  1920   1923   
  1921   1924   	/* Return in failure */
  1922   1925   	return(2);
  1923   1926   }