mirror of
https://github.com/fumiama/simple-kanban.git
synced 2026-06-05 08:20:29 +08:00
fix below c99
This commit is contained in:
3
file.h
3
file.h
@@ -26,7 +26,8 @@ static inline off_t get_file_size(int isdata) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int init_file(char* file_path[2]) {
|
static int init_file(char* file_path[2]) {
|
||||||
for (int i = 0; i < 2; i++) {
|
int i = 0;
|
||||||
|
for(; i < 2; i++) {
|
||||||
FILE* fp = fopen(file_path[i], "rb+");
|
FILE* fp = fopen(file_path[i], "rb+");
|
||||||
if(!fp) {
|
if(!fp) {
|
||||||
perror("Open file error");
|
perror("Open file error");
|
||||||
|
|||||||
7
tcpool.h
7
tcpool.h
@@ -327,7 +327,8 @@ static void accept_client(int fd) {
|
|||||||
pthread_attr_init(&__tcpool_thread_attr);
|
pthread_attr_init(&__tcpool_thread_attr);
|
||||||
pthread_attr_setdetachstate(&__tcpool_thread_attr, PTHREAD_CREATE_DETACHED);
|
pthread_attr_setdetachstate(&__tcpool_thread_attr, PTHREAD_CREATE_DETACHED);
|
||||||
TCPOOL_INIT_ACTION;
|
TCPOOL_INIT_ACTION;
|
||||||
for(int i = 0; i < TCPOOL_THREADCNT; i++) {
|
int i = 0;
|
||||||
|
for(; i < TCPOOL_THREADCNT; i++) {
|
||||||
pthread_rwlock_init(&tcpool_timers[i].mt, NULL);
|
pthread_rwlock_init(&tcpool_timers[i].mt, NULL);
|
||||||
pthread_rwlock_init(&tcpool_timers[i].mb, NULL);
|
pthread_rwlock_init(&tcpool_timers[i].mb, NULL);
|
||||||
}
|
}
|
||||||
@@ -390,7 +391,7 @@ static void accept_client(int fd) {
|
|||||||
} else {
|
} else {
|
||||||
pthread_cond_init(&timer->c, NULL);
|
pthread_cond_init(&timer->c, NULL);
|
||||||
pthread_mutex_init(&timer->mc, NULL);
|
pthread_mutex_init(&timer->mc, NULL);
|
||||||
if (pthread_create(&timer->thread, &__tcpool_thread_attr, (void (*)(void*))&handle_accept, timer)) {
|
if (pthread_create(&timer->thread, &__tcpool_thread_attr, (void* (*)(void*))&handle_accept, timer)) {
|
||||||
perror("Error creating thread");
|
perror("Error creating thread");
|
||||||
cleanup_thread(timer);
|
cleanup_thread(timer);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
@@ -405,7 +406,7 @@ static void accept_client(int fd) {
|
|||||||
pthread_cond_init(&timer->tc, NULL);
|
pthread_cond_init(&timer->tc, NULL);
|
||||||
pthread_mutex_init(&timer->tmc, NULL);
|
pthread_mutex_init(&timer->tmc, NULL);
|
||||||
timer->hastimerslept = 0;
|
timer->hastimerslept = 0;
|
||||||
if (pthread_create(&timer->timerthread, &__tcpool_thread_attr, (void (*)(void*))&accept_timer, timer)) {
|
if (pthread_create(&timer->timerthread, &__tcpool_thread_attr, (void* (*)(void*))&accept_timer, timer)) {
|
||||||
perror("Error creating timer thread");
|
perror("Error creating timer thread");
|
||||||
cleanup_thread(timer);
|
cleanup_thread(timer);
|
||||||
putchar('\n');
|
putchar('\n');
|
||||||
|
|||||||
Reference in New Issue
Block a user