Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xiph.Org
Icecast-Server
Commits
5d06975c
Commit
5d06975c
authored
Aug 10, 2002
by
Michael Smith
Browse files
Various cleanups
svn path=/trunk/icecast/; revision=3791
parent
05cbe25b
Changes
7
Hide whitespace changes
Inline
Side-by-side
src/config.c
View file @
5d06975c
...
...
@@ -103,6 +103,7 @@ int config_parse_file(const char *filename)
_config_filename
=
(
char
*
)
strdup
(
filename
);
xmlInitParser
();
doc
=
xmlParseFile
(
_config_filename
);
if
(
doc
==
NULL
)
{
return
CONFIG_EPARSE
;
...
...
@@ -111,17 +112,20 @@ int config_parse_file(const char *filename)
node
=
xmlDocGetRootElement
(
doc
);
if
(
node
==
NULL
)
{
xmlFreeDoc
(
doc
);
xmlCleanupParser
();
return
CONFIG_ENOROOT
;
}
if
(
strcmp
(
node
->
name
,
"icecast"
)
!=
0
)
{
xmlFreeDoc
(
doc
);
xmlCleanupParser
();
return
CONFIG_EBADROOT
;
}
_parse_root
(
doc
,
node
->
xmlChildrenNode
);
xmlFreeDoc
(
doc
);
xmlCleanupParser
();
return
0
;
}
...
...
src/connection.c
View file @
5d06975c
...
...
@@ -45,7 +45,7 @@ typedef struct con_queue_tag {
}
con_queue_t
;
typedef
struct
_thread_queue_tag
{
long
thread_id
;
thread_t
*
thread_id
;
struct
_thread_queue_tag
*
next
;
}
thread_queue_t
;
...
...
@@ -158,7 +158,7 @@ static void _signal_pool(void)
thread_cond_signal
(
&
_pool_cond
);
}
static
void
_push_thread
(
thread_queue_t
**
queue
,
long
thread_id
)
static
void
_push_thread
(
thread_queue_t
**
queue
,
thread_t
*
thread_id
)
{
/* create item */
thread_queue_t
*
item
=
(
thread_queue_t
*
)
malloc
(
sizeof
(
thread_queue_t
));
...
...
@@ -176,9 +176,9 @@ static void _push_thread(thread_queue_t **queue, long thread_id)
thread_mutex_unlock
(
&
_queue_mutex
);
}
static
long
_pop_thread
(
thread_queue_t
**
queue
)
static
thread_t
*
_pop_thread
(
thread_queue_t
**
queue
)
{
long
id
;
thread_t
*
id
;
thread_queue_t
*
item
;
thread_mutex_lock
(
&
_queue_mutex
);
...
...
@@ -186,7 +186,7 @@ static long _pop_thread(thread_queue_t **queue)
item
=
*
queue
;
if
(
item
==
NULL
)
{
thread_mutex_unlock
(
&
_queue_mutex
);
return
-
1
;
return
NULL
;
}
*
queue
=
item
->
next
;
...
...
@@ -202,7 +202,8 @@ static long _pop_thread(thread_queue_t **queue)
static
void
_build_pool
(
void
)
{
ice_config_t
*
config
;
int
i
,
tid
;
int
i
;
thread_t
*
tid
;
char
buff
[
64
];
config
=
config_get_config
();
...
...
@@ -216,14 +217,14 @@ static void _build_pool(void)
static
void
_destroy_pool
(
void
)
{
long
id
;
thread_t
*
id
;
int
i
;
i
=
0
;
thread_cond_broadcast
(
&
_pool_cond
);
id
=
_pop_thread
(
&
_conhands
);
while
(
id
!=
-
1
)
{
while
(
id
!=
NULL
)
{
thread_join
(
id
);
_signal_pool
();
id
=
_pop_thread
(
&
_conhands
);
...
...
src/log/log.c
View file @
5d06975c
...
...
@@ -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
);
...
...
src/slave.c
View file @
5d06975c
...
...
@@ -45,7 +45,7 @@
#define CATMODULE "slave"
static
void
*
_slave_thread
(
void
*
arg
);
long
_slave_thread_id
;
thread_t
*
_slave_thread_id
;
static
int
_initialized
=
0
;
void
slave_initialize
(
void
)
{
...
...
src/stats.c
View file @
5d06975c
...
...
@@ -33,7 +33,7 @@ typedef struct _event_listener_tag
}
event_listener_t
;
int
_stats_running
=
0
;
long
_stats_thread_id
;
thread_t
*
_stats_thread_id
;
int
_stats_threads
=
0
;
stats_t
_stats
;
...
...
src/thread/thread.c
View file @
5d06975c
...
...
@@ -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 */
...
...
src/thread/thread.h
View file @
5d06975c
...
...
@@ -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__ */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment