1
0
mirror of https://gitlab.xiph.org/xiph/icecast-common.git synced 2024-12-04 14:46:31 -05:00

Various cleanups

svn path=/trunk/log/; revision=3791
This commit is contained in:
Michael Smith 2002-08-10 03:22:44 +00:00
parent 379cb518d5
commit 30577a1391
3 changed files with 11 additions and 8 deletions

View File

@ -180,7 +180,11 @@ void log_write(int log_id, int priority, const char *cat, const char *func,
vsnprintf(line, LOG_MAXLINELEN, fmt, ap);
now = time(NULL);
/* localtime() isn't threadsafe, localtime_r isn't portable enough... */
_lock_logger();
strftime(tyme, 128, "[%Y-%m-%d %H:%M:%S]", localtime(&now));
_unlock_logger();
snprintf(pre, 256, "%s %s%s", prior[priority-1], cat, func);

View File

@ -228,7 +228,7 @@ static void _catch_signals(void)
}
long thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int detached, int line, char *file)
thread_t *thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int detached, int line, char *file)
{
int created;
thread_t *thread;
@ -259,11 +259,10 @@ long thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int
if (created == 0) {
LOG_ERROR("System won't let me create more threads, giving up");
return -1;
return NULL;
}
// return thread->thread_id;
return thread->sys_thread;
return thread;
}
/* _mutex_create
@ -676,12 +675,12 @@ void thread_library_unlock(void)
_mutex_unlock(&_library_mutex);
}
void thread_join(long thread)
void thread_join(thread_t *thread)
{
void *ret;
int i;
i = pthread_join(thread, &ret);
i = pthread_join(thread->sys_thread, &ret);
}
/* AVL tree functions */

View File

@ -105,7 +105,7 @@ void thread_initialize_with_log_id(int log_id);
void thread_shutdown(void);
/* creation, destruction, locking, unlocking, signalling and waiting */
long thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int detached, int line, char *file);
thread_t *thread_create_c(char *name, void *(*start_routine)(void *), void *arg, int detached, int line, char *file);
void thread_mutex_create_c(mutex_t *mutex, int line, char *file);
void thread_mutex_lock_c(mutex_t *mutex, int line, char *file);
void thread_mutex_unlock_c(mutex_t *mutex, int line, char *file);
@ -138,7 +138,7 @@ thread_t *thread_self(void);
void thread_rename(const char *name);
/* waits until thread_exit is called for another thread */
void thread_join(long thread);
void thread_join(thread_t *thread);
#endif /* __THREAD_H__ */