Added `refcount' field. New functions to deal with refcounts.
1999-12-05 Martin Baulig <martin@home-of-linux.org> * glibtop.h (glibtop): Added `refcount' field. * lib/init.c (glibtop_server_ref, glibtop_server_unref): New functions to deal with refcounts.
This commit is contained in:
committed by
Martin Baulig
parent
f5efccc8d6
commit
c1cae4e9ba
24
lib/init.c
24
lib/init.c
@@ -154,6 +154,30 @@ _init_server (glibtop *server, const unsigned features)
|
||||
glibtop_free_r (server, command);
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_server_ref (glibtop *server)
|
||||
{
|
||||
if (server == NULL)
|
||||
return;
|
||||
|
||||
server->refcount++;
|
||||
}
|
||||
|
||||
void
|
||||
glibtop_server_unref (glibtop *server)
|
||||
{
|
||||
if (server == NULL)
|
||||
return;
|
||||
|
||||
if (!server->refcount) {
|
||||
glibtop_warn_r (server, "Attempted to unref server "
|
||||
"which refcount == 0");
|
||||
return;
|
||||
}
|
||||
|
||||
server->refcount--;
|
||||
}
|
||||
|
||||
glibtop *
|
||||
glibtop_init_r (glibtop **server_ptr, unsigned long features, unsigned flags)
|
||||
{
|
||||
|
Reference in New Issue
Block a user