services: Get rid of unnecessary locks.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
34fd639801
commit
4931f5fbe9
|
@ -274,7 +274,6 @@ DWORD __cdecl svcctl_GetServiceDisplayNameW(
|
||||||
{
|
{
|
||||||
LPCWSTR name;
|
LPCWSTR name;
|
||||||
int len;
|
int len;
|
||||||
service_lock(entry);
|
|
||||||
name = get_display_name(entry);
|
name = get_display_name(entry);
|
||||||
len = strlenW(name);
|
len = strlenW(name);
|
||||||
if (len <= *cchBufSize)
|
if (len <= *cchBufSize)
|
||||||
|
@ -285,7 +284,6 @@ DWORD __cdecl svcctl_GetServiceDisplayNameW(
|
||||||
else
|
else
|
||||||
err = ERROR_INSUFFICIENT_BUFFER;
|
err = ERROR_INSUFFICIENT_BUFFER;
|
||||||
*cchBufSize = len;
|
*cchBufSize = len;
|
||||||
service_unlock(entry);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
err = ERROR_SERVICE_DOES_NOT_EXIST;
|
err = ERROR_SERVICE_DOES_NOT_EXIST;
|
||||||
|
@ -319,7 +317,6 @@ DWORD __cdecl svcctl_GetServiceKeyNameW(
|
||||||
if (entry != NULL)
|
if (entry != NULL)
|
||||||
{
|
{
|
||||||
int len;
|
int len;
|
||||||
service_lock(entry);
|
|
||||||
len = strlenW(entry->name);
|
len = strlenW(entry->name);
|
||||||
if (len <= *cchBufSize)
|
if (len <= *cchBufSize)
|
||||||
{
|
{
|
||||||
|
@ -329,7 +326,6 @@ DWORD __cdecl svcctl_GetServiceKeyNameW(
|
||||||
else
|
else
|
||||||
err = ERROR_INSUFFICIENT_BUFFER;
|
err = ERROR_INSUFFICIENT_BUFFER;
|
||||||
*cchBufSize = len;
|
*cchBufSize = len;
|
||||||
service_unlock(entry);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
err = ERROR_SERVICE_DOES_NOT_EXIST;
|
err = ERROR_SERVICE_DOES_NOT_EXIST;
|
||||||
|
@ -539,9 +535,7 @@ static DWORD create_serviceW(
|
||||||
|
|
||||||
if ((found = scmdatabase_find_service(manager->db, lpServiceName)))
|
if ((found = scmdatabase_find_service(manager->db, lpServiceName)))
|
||||||
{
|
{
|
||||||
service_lock(found);
|
|
||||||
err = is_marked_for_delete(found) ? ERROR_SERVICE_MARKED_FOR_DELETE : ERROR_SERVICE_EXISTS;
|
err = is_marked_for_delete(found) ? ERROR_SERVICE_MARKED_FOR_DELETE : ERROR_SERVICE_EXISTS;
|
||||||
service_unlock(found);
|
|
||||||
scmdatabase_unlock(manager->db);
|
scmdatabase_unlock(manager->db);
|
||||||
free_service_entry(entry);
|
free_service_entry(entry);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -435,9 +435,7 @@ void release_service(struct service_entry *service)
|
||||||
if (InterlockedDecrement(&service->ref_count) == 0 && is_marked_for_delete(service))
|
if (InterlockedDecrement(&service->ref_count) == 0 && is_marked_for_delete(service))
|
||||||
{
|
{
|
||||||
scmdatabase_lock(service->db);
|
scmdatabase_lock(service->db);
|
||||||
service_lock(service);
|
|
||||||
scmdatabase_remove_service(service->db, service);
|
scmdatabase_remove_service(service->db, service);
|
||||||
service_unlock(service);
|
|
||||||
scmdatabase_unlock(service->db);
|
scmdatabase_unlock(service->db);
|
||||||
free_service_entry(service);
|
free_service_entry(service);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue