Changeset 498ced1 in mainline for uspace/srv/net
- Timestamp:
- 2018-08-11T02:43:32Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 05882233
- Parents:
- b13d80b
- git-author:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-11 02:29:02)
- git-committer:
- Jiří Zárevúcky <jiri.zarevucky@…> (2018-08-11 02:43:32)
- Location:
- uspace/srv/net
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/net/tcp/conn.c
rb13d80b r498ced1 128 128 129 129 /* One for the user, one for not being in closed state */ 130 atomic_set(&conn->refcnt, 2); 130 refcount_init(&conn->refcnt); 131 refcount_up(&conn->refcnt); 131 132 132 133 /* Allocate receive buffer */ … … 238 239 void tcp_conn_addref(tcp_conn_t *conn) 239 240 { 240 log_msg(LOG_DEFAULT, LVL_DEBUG2, "%s: tcp_conn_addref(%p) before=%zu", 241 conn->name, conn, atomic_get(&conn->refcnt)); 242 atomic_inc(&conn->refcnt); 241 log_msg(LOG_DEFAULT, LVL_DEBUG2, "%s: tcp_conn_addref(%p)", 242 conn->name, conn); 243 244 refcount_up(&conn->refcnt); 243 245 } 244 246 … … 251 253 void tcp_conn_delref(tcp_conn_t *conn) 252 254 { 253 log_msg(LOG_DEFAULT, LVL_DEBUG2, "%s: tcp_conn_delref(%p) before=%zu",254 conn->name, conn , atomic_get(&conn->refcnt));255 256 if ( atomic_predec(&conn->refcnt) == 0)255 log_msg(LOG_DEFAULT, LVL_DEBUG2, "%s: tcp_conn_delref(%p)", 256 conn->name, conn); 257 258 if (refcount_down(&conn->refcnt)) 257 259 tcp_conn_free(conn); 258 260 } -
uspace/srv/net/tcp/tcp_type.h
rb13d80b r498ced1 41 41 #include <fibril.h> 42 42 #include <fibril_synch.h> 43 #include <refcount.h> 43 44 #include <stddef.h> 44 45 #include <stdint.h> … … 248 249 fibril_mutex_t lock; 249 250 /** Reference count */ 250 atomic_ t refcnt;251 atomic_refcount_t refcnt; 251 252 252 253 /** Connection state */ -
uspace/srv/net/udp/assoc.c
rb13d80b r498ced1 91 91 92 92 /* One for the user */ 93 atomic_set(&assoc->refcnt, 1);93 refcount_init(&assoc->refcnt); 94 94 95 95 /* Initialize receive queue */ … … 145 145 { 146 146 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: upd_assoc_addref(%p)", assoc->name, assoc); 147 atomic_inc(&assoc->refcnt);147 refcount_up(&assoc->refcnt); 148 148 } 149 149 … … 158 158 log_msg(LOG_DEFAULT, LVL_DEBUG, "%s: udp_assoc_delref(%p)", assoc->name, assoc); 159 159 160 if ( atomic_predec(&assoc->refcnt) == 0)160 if (refcount_down(&assoc->refcnt)) 161 161 udp_assoc_free(assoc); 162 162 } -
uspace/srv/net/udp/udp_type.h
rb13d80b r498ced1 41 41 #include <inet/endpoint.h> 42 42 #include <ipc/loc.h> 43 #include <refcount.h> 43 44 #include <stdbool.h> 44 45 #include <stddef.h> … … 114 115 fibril_mutex_t lock; 115 116 /** Reference count */ 116 atomic_ t refcnt;117 atomic_refcount_t refcnt; 117 118 118 119 /** Receive queue */
Note:
See TracChangeset
for help on using the changeset viewer.