* Sunnyvale, CA 94085, USA, or: http://www.zmanda.com
*/
+#include "amanda.h"
#include "amxfer.h"
#include "element-glue.h"
-#include "amanda.h"
#include "arglist.h"
/* XMsgSource objects are GSource "subclasses" which manage
xfer->status = XFER_INIT;
xfer->status_mutex = g_mutex_new();
xfer->status_cond = g_cond_new();
+ xfer->fd_mutex = g_mutex_new();
xfer->refcount = 1;
xfer->repr = NULL;
g_mutex_free(xfer->status_mutex);
g_cond_free(xfer->status_cond);
+ g_mutex_free(xfer->fd_mutex);
/* Free our references to the elements, and also set the 'xfer'
* attribute of each to NULL, making them "unattached" (although
xfer_cancel(elt->xfer);
}
+gint
+xfer_atomic_swap_fd(Xfer *xfer, gint *fdp, gint newfd)
+{
+ gint rv;
+
+ if (xfer)
+ g_mutex_lock(xfer->fd_mutex);
+ rv = *fdp;
+ *fdp = newfd;
+ if (xfer)
+ g_mutex_unlock(xfer->fd_mutex);
+
+ return rv;
+}