void ConcurrentG1Refine::adjust(double update_rs_time, size_t update_rs_processed_buffers, double goal_ms) { DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); if (G1UseAdaptiveConcRefinement) { update_zones(update_rs_time, update_rs_processed_buffers, goal_ms); update_thread_thresholds(); // Change the barrier params if (_n_worker_threads == 0) { // Disable dcqs notification when there are no threads to notify. dcqs.set_process_completed_threshold(INT_MAX); } else { // Worker 0 is the primary; wakeup is via dcqs notification. STATIC_ASSERT(max_yellow_zone <= INT_MAX); size_t activate = _threads[0]->activation_threshold(); dcqs.set_process_completed_threshold((int)activate); } dcqs.set_max_completed_queue((int)red_zone()); } size_t curr_queue_size = dcqs.completed_buffers_num(); if (curr_queue_size >= yellow_zone()) { dcqs.set_completed_queue_padding(curr_queue_size); } else { dcqs.set_completed_queue_padding(0); } dcqs.notify_if_necessary(); }
int main(int argc, char **argv) { FILE *fp; int iostream; char database[128]; char directory[128]; char execute[128]; char password[128]; char username[128]; char server[128]; char serials[32]; char buf[1024]; char val[128]; int update; MYSQL dbh; /* default values */ strcpy(database, "dns"); strcpy(directory, "/var/named/dynamic"); strcpy(execute, ""); strcpy(password, ""); strcpy(username, "root"); strcpy(server, "localhost"); strcpy(serials, ""); update = 60; openlog(PROG_NAME, LOG_PID, LOG_DAEMON); /* read options */ if ((fp = fopen("/etc/mysql2dns.conf", "r")) == NULL) { syslog(LOG_ERR, "ERROR: reading /etc/mysql2dns.conf"); exit(EXIT_FAILURE); } while (fgets(buf, sizeof(buf), fp)) { if ((buf[0] == '#') || (buf[0] == '\n')) { continue; } else if ((sscanf(buf, "database: %127[A-Za-z0-9 .:/_+-]", val)) == 1) { snprintf(database, sizeof(database), "%s", val); continue; } else if ((sscanf(buf, "directory: %127[A-Za-z0-9 .:/_+-]", val)) == 1) { snprintf(directory, sizeof(directory), "%s", val); continue; } else if ((sscanf(buf, "execute: %127[A-Za-z0-9 .:/_+-]", val)) == 1) { snprintf(execute, sizeof(execute), "%s", val); continue; } else if ((sscanf(buf, "password: %127[A-Za-z0-9 .:/_+-]", val)) == 1) { snprintf(password, sizeof(password), "%s", val); continue; } else if ((sscanf(buf, "username: %127[A-Za-z0-9 .:/_+-]", val)) == 1) { snprintf(username, sizeof(username), "%s", val); continue; } else if ((sscanf(buf, "server: %127[A-Za-z0-9 .:/_+-]", val)) == 1) { snprintf(server, sizeof(server), "%s", val); continue; } else if ((sscanf(buf, "update: %127[A-Za-z0-9 .:/_+-]", val)) == 1) { update = atoi(val); continue; } } fclose(fp); /* go to background */ if (fork()) exit(EXIT_SUCCESS); close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); iostream = open(_PATH_DEVNULL, O_RDWR); dup(iostream); dup(iostream); if (!mysql_init(&dbh)) { syslog(LOG_ERR, "%s", mysql_error(&dbh)); exit(EXIT_FAILURE); } do { if (!mysql_real_connect(&dbh, server, username, password, database, 0, NULL, 0)) { syslog(LOG_ERR, "%s", mysql_error(&dbh)); } else if (change_serials(&dbh, serials, sizeof(serials))) { update_zones(&dbh, directory); if (strlen(execute)) { system(execute); } mysql_close(&dbh); } } while (!sleep(update)); closelog(); return 0; }