Browse Source

Remove now-unused blocking-wait code (restart_cond, restart_wait, and stale_wait)

Luke Dashjr 13 years ago
parent
commit
0380fe4f06
3 changed files with 0 additions and 87 deletions
  1. 0 10
      driver-bitforce.c
  2. 0 72
      miner.c
  3. 0 5
      miner.h

+ 0 - 10
driver-bitforce.c

@@ -629,16 +629,6 @@ commerr:
 	job_start_abort(thr, true);
 }
 
-static inline int noisy_stale_wait(unsigned int mstime, struct work*work, bool checkend, struct cgpu_info*bitforce)
-{
-	int rv = stale_wait(mstime, work, checkend);
-	if (rv)
-		applog(LOG_NOTICE, "%"PRIpreprv": Abandoning stale search to restart",
-		       bitforce->proc_repr);
-	return rv;
-}
-#define noisy_stale_wait(mstime, work, checkend)  noisy_stale_wait(mstime, work, checkend, bitforce)
-
 static char _discardedbuf[0x10];
 
 static

+ 0 - 72
miner.c

@@ -214,9 +214,6 @@ pthread_rwlock_t netacc_lock;
 static pthread_mutex_t lp_lock;
 static pthread_cond_t lp_cond;
 
-pthread_mutex_t restart_lock;
-pthread_cond_t restart_cond;
-
 pthread_cond_t gws_cond;
 
 bool shutting_down;
@@ -4264,36 +4261,6 @@ static void discard_stale(void)
 		applog(LOG_DEBUG, "Discarded %d stales that didn't match current hash", stale);
 }
 
-void ms_to_abstime(unsigned int mstime, struct timespec *abstime)
-{
-	struct timeval now, then, tdiff;
-
-	tdiff.tv_sec = mstime / 1000;
-	tdiff.tv_usec = mstime * 1000 - (tdiff.tv_sec * 1000000);
-	gettimeofday(&now, NULL);
-	timeradd(&now, &tdiff, &then);
-	abstime->tv_sec = then.tv_sec;
-	abstime->tv_nsec = then.tv_usec * 1000;
-}
-
-/* A generic wait function for threads that poll that will wait a specified
- * time tdiff waiting on the pthread conditional that is broadcast when a
- * work restart is required. Returns the value of pthread_cond_timedwait
- * which is zero if the condition was met or ETIMEDOUT if not.
- */
-int restart_wait(unsigned int mstime)
-{
-	struct timespec abstime;
-	int rc;
-
-	ms_to_abstime(mstime, &abstime);
-	mutex_lock(&restart_lock);
-	rc = pthread_cond_timedwait(&restart_cond, &restart_lock, &abstime);
-	mutex_unlock(&restart_lock);
-
-	return rc;
-}
-
 bool stale_work_future(struct work *work, bool share, unsigned long ustime)
 {
 	bool rv;
@@ -4313,37 +4280,6 @@ bool stale_work_future(struct work *work, bool share, unsigned long ustime)
 	return rv;
 }
 
-/* A generic wait function for threads that poll that will wait a specified
- * time waiting on a share to become stale. Returns positive if the share
- * became stale or zero if the timer expired first. If checkend is true, will
- * immediatley return negative if the share is guaranteed to become stale
- * before the timer expires.
- */
-int stale_wait(unsigned int mstime, struct work*work, bool checkend)
-{
-	struct timespec abstime;
-	int rc;
-
-	if (checkend) {
-		if (stale_work_future(work, true, mstime * 1000))
-			return -1;
-	}
-
-	ms_to_abstime(mstime, &abstime);
-	rc = -1;
-	while (1) {
-		mutex_lock(&restart_lock);
-		if (stale_work(work, true)) {
-			rc = 1;
-		} else if (pthread_cond_timedwait(&restart_cond, &restart_lock, &abstime)) {
-			rc = 0;
-		}
-		mutex_unlock(&restart_lock);
-		if (rc != -1)
-			return rc;
-	}
-}
-	
 static void restart_threads(void)
 {
 	struct pool *cp = current_pool();
@@ -4368,10 +4304,6 @@ static void restart_threads(void)
 		thr = &thr_info[i];
 		notifier_wake(thr->work_restart_notifier);
 	}
-
-	mutex_lock(&restart_lock);
-	pthread_cond_broadcast(&restart_cond);
-	mutex_unlock(&restart_lock);
 }
 
 static char *blkhashstr(unsigned char *hash)
@@ -7746,10 +7678,6 @@ int main(int argc, char *argv[])
 	if (unlikely(pthread_cond_init(&lp_cond, NULL)))
 		quit(1, "Failed to pthread_cond_init lp_cond");
 
-	mutex_init(&restart_lock);
-	if (unlikely(pthread_cond_init(&restart_cond, NULL)))
-		quit(1, "Failed to pthread_cond_init restart_cond");
-
 	if (unlikely(pthread_cond_init(&gws_cond, NULL)))
 		quit(1, "Failed to pthread_cond_init gws_cond");
 

+ 0 - 5
miner.h

@@ -783,16 +783,11 @@ extern pthread_mutex_t hash_lock;
 extern pthread_mutex_t console_lock;
 extern pthread_mutex_t ch_lock;
 
-extern pthread_mutex_t restart_lock;
-extern pthread_cond_t restart_cond;
-
 extern void thread_reportin(struct thr_info *thr);
 extern void thread_reportout(struct thr_info *);
 extern void hashmeter2(struct thr_info *);
-extern int restart_wait(unsigned int mstime);
 extern bool stale_work(struct work *, bool share);
 extern bool stale_work_future(struct work *, bool share, unsigned long ustime);
-extern int stale_wait(unsigned int mstime, struct work*, bool checkend);
 
 extern void kill_work(void);
 extern void app_restart(void);