From 15e66ba37ae56787897e49039e217b5426924829 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 25 May 2001 00:48:28 +0000 Subject: Added tdb_change_int_atomic() to allow atomic updates of a tdb int value. Jeremy. (This used to be commit cf5015f15935605cf69078bc15251db61ddc48c7) --- source3/smbd/server.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'source3/smbd/server.c') diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 6f4f18562e..fcee30d667 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -421,16 +421,14 @@ static BOOL dump_core(void) /**************************************************************************** update the current smbd process count ****************************************************************************/ + static void decrement_smbd_process_count(void) { int total_smbds; if (lp_max_smbd_processes()) { - tdb_lock_bystring(conn_tdb_ctx(), "INFO/total_smbds"); - if ((total_smbds = tdb_fetch_int(conn_tdb_ctx(), "INFO/total_smbds")) > 0) - tdb_store_int(conn_tdb_ctx(), "INFO/total_smbds", total_smbds - 1); - - tdb_unlock_bystring(conn_tdb_ctx(), "INFO/total_smbds"); + total_smbds = 0; + tdb_change_int_atomic(conn_tdb_ctx(), "INFO/total_smbds", &total_smbds, -1); } } -- cgit