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
acd1b8ad
Commit
acd1b8ad
authored
Apr 20, 2005
by
Karl Heyes
Browse files
merge from branch, make the config lock a rwlock instead of mutex
svn path=/icecast/trunk/icecast/; revision=9160
parent
19cb11cc
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/cfgfile.c
View file @
acd1b8ad
...
...
@@ -87,13 +87,13 @@ static void _add_server(xmlDocPtr doc, xmlNodePtr node, ice_config_t *c);
static
void
create_locks
()
{
thread_mutex_create
(
&
_locks
.
relay_lock
);
thread_mutex_create
(
&
_locks
.
mounts_lock
);
thread_
mutex
_create
(
&
_locks
.
config_lock
);
thread_
rwlock
_create
(
&
_locks
.
config_lock
);
}
static
void
release_locks
()
{
thread_mutex_destroy
(
&
_locks
.
relay_lock
);
thread_mutex_destroy
(
&
_locks
.
mounts_lock
);
thread_
mutex
_destroy
(
&
_locks
.
config_lock
);
thread_
rwlock
_destroy
(
&
_locks
.
config_lock
);
}
void
config_initialize
(
void
)
{
...
...
@@ -226,7 +226,7 @@ void config_clear(ice_config_t *c)
}
#ifdef USE_YP
i
=
0
;
while
(
i
<
c
->
num_yp_directories
)
while
(
i
<
c
->
num_yp_directories
)
{
xmlFree
(
c
->
yp_url
[
i
]);
i
++
;
...
...
@@ -291,12 +291,18 @@ ice_config_locks *config_locks(void)
void
config_release_config
(
void
)
{
thread_
mutex
_unlock
(
&
(
_locks
.
config_lock
));
thread_
rwlock
_unlock
(
&
(
_locks
.
config_lock
));
}
ice_config_t
*
config_get_config
(
void
)
{
thread_mutex_lock
(
&
(
_locks
.
config_lock
));
thread_rwlock_rlock
(
&
(
_locks
.
config_lock
));
return
&
_current_configuration
;
}
ice_config_t
*
config_grab_config
(
void
)
{
thread_rwlock_wlock
(
&
(
_locks
.
config_lock
));
return
&
_current_configuration
;
}
...
...
@@ -614,7 +620,6 @@ static void _parse_mount(xmlDocPtr doc, xmlNodePtr node,
mount
->
burst_size
=
atoi
(
tmp
);
if
(
tmp
)
xmlFree
(
tmp
);
}
else
if
(
strcmp
(
node
->
name
,
"cluster-password"
)
==
0
)
{
tmp
=
(
char
*
)
xmlNodeListGetString
(
doc
,
node
->
xmlChildrenNode
,
1
);
mount
->
cluster_password
=
(
char
*
)
xmlNodeListGetString
(
doc
,
node
->
xmlChildrenNode
,
1
);
}
...
...
src/cfgfile.h
View file @
acd1b8ad
...
...
@@ -146,7 +146,7 @@ typedef struct ice_config_tag
}
ice_config_t
;
typedef
struct
{
mutex
_t
config_lock
;
rwlock
_t
config_lock
;
mutex_t
relay_lock
;
mutex_t
mounts_lock
;
}
ice_config_locks
;
...
...
@@ -165,6 +165,7 @@ int config_rehash(void);
ice_config_locks
*
config_locks
(
void
);
ice_config_t
*
config_get_config
(
void
);
ice_config_t
*
config_grab_config
(
void
);
void
config_release_config
(
void
);
/* To be used ONLY in one-time startup code */
...
...
src/event.c
View file @
acd1b8ad
...
...
@@ -32,7 +32,7 @@ void event_config_read(void *arg)
ice_config_t
new_config
;
/* reread config file */
config
=
config_g
et
_config
();
/* Both to get the lock, and to be able
config
=
config_g
rab
_config
();
/* Both to get the lock, and to be able
to find out the config filename */
ret
=
config_parse_file
(
config
->
config_filename
,
&
new_config
);
if
(
ret
<
0
)
{
...
...
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