Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Synchronet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
127
Issues
127
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main
Synchronet
Compare Revisions
a6e8c33c9a4d063223246ab6786d7411639ecee7...3c2f025f6ce4ecbaef308f5e0f3dc933bd27166e
Source
3c2f025f6ce4ecbaef308f5e0f3dc933bd27166e
Select Git revision
...
Target
a6e8c33c9a4d063223246ab6786d7411639ecee7
Select Git revision
Compare
Commits (1)
Add protected_*_adjust_fetch() which provides the modified value.
· 3c2f025f
Deucе
authored
Feb 18, 2021
protected_*_adjust() only adjusts now.
3c2f025f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
14 deletions
+29
-14
src/sbbs3/ftpsrvr.c
src/sbbs3/ftpsrvr.c
+2
-2
src/sbbs3/mailsrvr.c
src/sbbs3/mailsrvr.c
+1
-1
src/sbbs3/main.cpp
src/sbbs3/main.cpp
+2
-2
src/sbbs3/websrvr.c
src/sbbs3/websrvr.c
+1
-1
src/xpdev/threadwrap.h
src/xpdev/threadwrap.h
+23
-8
No files found.
src/sbbs3/ftpsrvr.c
View file @
3c2f025f
...
...
@@ -225,7 +225,7 @@ static void thread_up(BOOL setuid)
static
int32_t
thread_down
(
void
)
{
int32_t
count
=
protected_uint32_adjust
(
&
thread_count
,
-
1
);
int32_t
count
=
protected_uint32_adjust
_fetch
(
&
thread_count
,
-
1
);
if
(
startup
!=
NULL
&&
startup
->
thread_up
!=
NULL
)
startup
->
thread_up
(
startup
->
cbdata
,
FALSE
,
FALSE
);
return
count
;
...
...
@@ -5002,7 +5002,7 @@ static void ctrl_thread(void* arg)
ftp_close_socket
(
&
tmp_sock
,
&
sess
,
__LINE__
);
{
int32_t
clients
=
protected_uint32_adjust
(
&
active_clients
,
-
1
);
int32_t
clients
=
protected_uint32_adjust
_fetch
(
&
active_clients
,
-
1
);
int32_t
threads
=
thread_down
();
update_clients
();
...
...
src/sbbs3/mailsrvr.c
View file @
3c2f025f
...
...
@@ -267,7 +267,7 @@ static void thread_up(BOOL setuid)
static
int32_t
thread_down
(
void
)
{
int32_t
count
=
protected_uint32_adjust
(
&
thread_count
,
-
1
);
int32_t
count
=
protected_uint32_adjust
_fetch
(
&
thread_count
,
-
1
);
if
(
startup
!=
NULL
&&
startup
->
thread_up
!=
NULL
)
startup
->
thread_up
(
startup
->
cbdata
,
FALSE
,
FALSE
);
return
count
;
...
...
src/sbbs3/main.cpp
View file @
3c2f025f
...
...
@@ -57,7 +57,7 @@
lprintf
(
LOG_ERR
,
"%04d SSH Error %d destroying Cryptlib Session %d from line %d"
,
sock
,
result
,
session
,
line
);
else
{
uint32_t
remain
=
protected_uint32_adjust
(
&
ssh_sessions
,
-
1
);
uint32_t
remain
=
protected_uint32_adjust
_fetch
(
&
ssh_sessions
,
-
1
);
lprintf
(
LOG_DEBUG
,
"%04d SSH Cryptlib Session: %d destroyed from line %d (%u remain)"
,
sock
,
session
,
line
,
remain
);
}
...
...
@@ -4687,7 +4687,7 @@ void node_thread(void* arg)
/* crash here on Aug-4-2015:
node_thread_running already destroyed
bbs_thread() timed out waiting for 1 node thread(s) to terminate */
int32_t
remain
=
protected_uint32_adjust
(
&
node_threads_running
,
-
1
);
uint32_t
remain
=
protected_uint32_adjust_fetch
(
&
node_threads_running
,
-
1
);
lprintf
(
LOG_INFO
,
"Node %d thread terminated (%u node threads remain, %lu clients served)"
,
sbbs
->
cfg
.
node_num
,
remain
,
served
);
}
...
...
src/sbbs3/websrvr.c
View file @
3c2f025f
...
...
@@ -6687,7 +6687,7 @@ void http_session_thread(void* arg)
RingBufDispose
(
&
session
.
outbuf
);
FREE_AND_NULL
(
session
.
subscan
);
clients_remain
=
protected_uint32_adjust
(
&
active_clients
,
-
1
);
clients_remain
=
protected_uint32_adjust
_fetch
(
&
active_clients
,
-
1
);
update_clients
();
client_off
(
socket
);
...
...
src/xpdev/threadwrap.h
View file @
3c2f025f
...
...
@@ -168,10 +168,15 @@ typedef std::atomic<uint64_t> protected_uint64_t;
#define protected_int64_init(pval, val) (std::atomic_store<int64_t>(pval, val), 0)
#define protected_uint64_init(pval, val) (std::atomic_store<uint64_t>(pval, val), 0)
#define protected_int32_adjust(pval, adj) (std::atomic_fetch_add<int32_t>(pval, adj) + adj)
#define protected_uint32_adjust(pval, adj) (std::atomic_fetch_add<uint32_t>(pval, adj) + adj)
#define protected_int64_adjust(pval, adj) (std::atomic_fetch_add<int64_t>(pval, adj) + adj)
#define protected_uint64_adjust(pval, adj) (std::atomic_fetch_add<uint64_t>(pval, adj) + adj)
#define protected_int32_adjust(pval, adj) std::atomic_fetch_add<int32_t>(pval, adj)
#define protected_uint32_adjust(pval, adj) std::atomic_fetch_add<uint32_t>(pval, adj)
#define protected_int64_adjust(pval, adj) std::atomic_fetch_add<int64_t>(pval, adj)
#define protected_uint64_adjust(pval, adj) std::atomic_fetch_add<uint64_t>(pval, adj)
#define protected_int32_adjust_fetch(pval, adj) (std::atomic_fetch_add<int32_t>(pval, adj) + adj)
#define protected_uint32_adjust_fetch(pval, adj) (std::atomic_fetch_add<uint32_t>(pval, adj) + adj)
#define protected_int64_adjust_fetch(pval, adj) (std::atomic_fetch_add<int64_t>(pval, adj) + adj)
#define protected_uint64_adjust_fetch(pval, adj) (std::atomic_fetch_add<uint64_t>(pval, adj) + adj)
#define protected_int32_value(val) std::atomic_load<int32_t>(&val)
#define protected_uint32_value(val) std::atomic_load<uint32_t>(&val)
...
...
@@ -188,10 +193,15 @@ typedef _Atomic(uint64_t) protected_uint64_t;
#define protected_int64_init(pval, val) (atomic_init(pval, val), 0)
#define protected_uint64_init(pval, val) (atomic_init(pval, val), 0)
#define protected_int32_adjust(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_uint32_adjust(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_int64_adjust(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_uint64_adjust(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_int32_adjust(pval, adj) atomic_fetch_add(pval, adj)
#define protected_uint32_adjust(pval, adj) atomic_fetch_add(pval, adj)
#define protected_int64_adjust(pval, adj) atomic_fetch_add(pval, adj)
#define protected_uint64_adjust(pval, adj) atomic_fetch_add(pval, adj)
#define protected_int32_adjust_fetch(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_uint32_adjust_fetch(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_int64_adjust_fetch(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_uint64_adjust_fetch(pval, adj) (atomic_fetch_add(pval, adj) + adj)
#define protected_int32_value(val) atomic_load(&val)
#define protected_uint32_value(val) atomic_load(&val)
...
...
@@ -236,6 +246,11 @@ typedef struct {
#define protected_int64_value(i) protected_int64_adjust(&i,0)
#define protected_uint64_value(i) protected_uint64_adjust(&i,0)
#define protected_int32_adjust_fetch(a, b) protected_int32_adjust(a, b)
#define protected_uint32_adjust_fetch(a, b) protected_uint32_adjust(a, b)
#define protected_int64_adjust_fetch(a, b) protected_int64_adjust(a, b)
#define protected_uint64_adjust_fetch(a, b) protected_uint64_adjust(a, b)
/* Return 0 on success, non-zero on failure (see pthread_mutex_init): */
DLLEXPORT
int
DLLCALL
protected_int32_init
(
protected_int32_t
*
,
int32_t
value
);
DLLEXPORT
int
DLLCALL
protected_int64_init
(
protected_int64_t
*
,
int64_t
value
);
...
...