mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-10 23:08:07 +00:00
Remove now unused temporary fix for algo switch
This commit is contained in:
parent
171e5dd824
commit
27709ced83
9
miner.h
9
miner.h
@ -245,15 +245,6 @@ enum drv_driver {
|
|||||||
DRIVER_PARSE_COMMANDS(DRIVER_PROTOTYPE)
|
DRIVER_PARSE_COMMANDS(DRIVER_PROTOTYPE)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Temp fix for 60 second exit after algo switch */
|
|
||||||
#define __TEMP_ALGO_SWITCH_FIX__ //comment this to turn off the fix if needed
|
|
||||||
#ifdef __TEMP_ALGO_SWITCH_FIX__
|
|
||||||
struct thread_fix {
|
|
||||||
pthread_t thread_id;
|
|
||||||
struct thread_fix *prev, *next;
|
|
||||||
};
|
|
||||||
#endif /* __TEMP_ALGO_SWITCH_FIX__ */
|
|
||||||
|
|
||||||
enum alive {
|
enum alive {
|
||||||
LIFE_WELL,
|
LIFE_WELL,
|
||||||
LIFE_SICK,
|
LIFE_SICK,
|
||||||
|
98
sgminer.c
98
sgminer.c
@ -71,95 +71,6 @@ char *curly = ":D";
|
|||||||
#define VERSION GIT_VERSION
|
#define VERSION GIT_VERSION
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Temp fix for 60 second exit after algo switch */
|
|
||||||
#ifdef __TEMP_ALGO_SWITCH_FIX__
|
|
||||||
static struct thread_fix *thread_fix_list = NULL, *thread_fix_last = NULL;
|
|
||||||
|
|
||||||
void thread_fix_push(pthread_t thread_id)
|
|
||||||
{
|
|
||||||
struct thread_fix *new_thread;
|
|
||||||
|
|
||||||
if(!(new_thread = (struct thread_fix *)malloc(sizeof(struct thread_fix))))
|
|
||||||
quit(1, "malloc failed in thread_fix_push()");
|
|
||||||
|
|
||||||
//apply settings
|
|
||||||
new_thread->thread_id = thread_id;
|
|
||||||
new_thread->prev = new_thread->next = NULL;
|
|
||||||
|
|
||||||
//empty list add to head and tail
|
|
||||||
if(!thread_fix_list)
|
|
||||||
{
|
|
||||||
thread_fix_list = new_thread;
|
|
||||||
thread_fix_last = new_thread;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
thread_fix_last->next = new_thread;
|
|
||||||
new_thread->prev = thread_fix_last;
|
|
||||||
thread_fix_last = new_thread;
|
|
||||||
}
|
|
||||||
|
|
||||||
applog(LOG_DEBUG, "thread_fix_push(%d)", new_thread->thread_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct thread_fix *thread_fix_search(pthread_t thread_id)
|
|
||||||
{
|
|
||||||
struct thread_fix *p;
|
|
||||||
|
|
||||||
if(!thread_fix_list)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
p = thread_fix_list;
|
|
||||||
while(p != NULL)
|
|
||||||
{
|
|
||||||
if(pthread_equal(p->thread_id, thread_id))
|
|
||||||
return p;
|
|
||||||
|
|
||||||
p = p->next;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void thread_fix_pop(pthread_t thread_id)
|
|
||||||
{
|
|
||||||
struct thread_fix *p;
|
|
||||||
|
|
||||||
if(!(p = thread_fix_search(thread_id)))
|
|
||||||
return;
|
|
||||||
|
|
||||||
//only 1 item
|
|
||||||
if((p == thread_fix_list) && (p == thread_fix_last))
|
|
||||||
{
|
|
||||||
thread_fix_list = NULL;
|
|
||||||
thread_fix_last = NULL;
|
|
||||||
}
|
|
||||||
//first item
|
|
||||||
else if(p == thread_fix_list)
|
|
||||||
{
|
|
||||||
p->next->prev = NULL;
|
|
||||||
thread_fix_list = p->next;
|
|
||||||
}
|
|
||||||
//last item
|
|
||||||
else if(p == thread_fix_list)
|
|
||||||
{
|
|
||||||
p->prev->next = NULL;
|
|
||||||
thread_fix_last = p->prev;
|
|
||||||
}
|
|
||||||
//middle
|
|
||||||
else
|
|
||||||
{
|
|
||||||
p->prev->next = p->next;
|
|
||||||
p->next->prev = p->prev;
|
|
||||||
}
|
|
||||||
|
|
||||||
applog(LOG_DEBUG, "thread_fix_pop(%d)", p->thread_id);
|
|
||||||
|
|
||||||
//free memory
|
|
||||||
free(p);
|
|
||||||
}
|
|
||||||
#endif /* __TEMP_ALGO_SWITCH_FIX__ */
|
|
||||||
|
|
||||||
static char packagename[256];
|
static char packagename[256];
|
||||||
|
|
||||||
static bool startup = true; //sgminer is starting up
|
static bool startup = true; //sgminer is starting up
|
||||||
@ -8200,18 +8111,9 @@ static void *restart_mining_threads_thread(void *userdata)
|
|||||||
//detach
|
//detach
|
||||||
pthread_detach(t);
|
pthread_detach(t);
|
||||||
|
|
||||||
#ifdef __TEMP_ALGO_SWITCH_FIX__
|
|
||||||
//put in list of active threads
|
|
||||||
thread_fix_push(t);
|
|
||||||
#endif /* __TEMP_ALGO_SWITCH_FIX__ */
|
|
||||||
|
|
||||||
//restart mining threads
|
//restart mining threads
|
||||||
restart_mining_threads((unsigned int) (intptr_t) userdata);
|
restart_mining_threads((unsigned int) (intptr_t) userdata);
|
||||||
|
|
||||||
#ifdef __TEMP_ALGO_SWITCH_FIX__
|
|
||||||
//remove from list of active threads
|
|
||||||
thread_fix_pop(t);
|
|
||||||
#endif /* __TEMP_ALGO_SWITCH_FIX__ */
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user