summaryrefslogtreecommitdiff
path: root/libcli/auth
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2018-08-13 15:07:06 +0200
committerVolker Lendecke <vl@samba.org>2018-08-14 11:42:10 +0200
commit00513daf78eb29996c81ca4d3be9e71a8e872829 (patch)
tree7ccc7739226818abaaae1228bf04c2efd5e018df /libcli/auth
parent6b3cc7916b81e001b886b9c632babe345ca21d76 (diff)
downloadsamba-00513daf78eb29996c81ca4d3be9e71a8e872829.tar.gz
g_lock: Simplify g_lock_trylock
While chasing a bug in g_lock (not in master) I saw some opportunity to simplify g_lock_trylock a bit. This is array handling, and array handling is just extremely error-prone. This *might* be a little less efficient or large numbers of READ locks, but this remains to be seen. For now, simplify the code. First, we make two passes now: One to remove ourselves, and the other one to search for conflicts. Mixing up both made it pretty hard for me to follow the code. Second, I've removed the _mylock and mylock pointer/struct logic and replaced it with the "mylock.pid.pid != 0 ? &mylock : NULL" when calling g_lock_store. To me, this focuses the logic whether to add ourselves in one place instead of spreading it around in the whole routine. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Volker Lendecke <vl@samba.org> Autobuild-Date(master): Tue Aug 14 11:42:10 CEST 2018 on sn-devel-144
Diffstat (limited to 'libcli/auth')
0 files changed, 0 insertions, 0 deletions