summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRyo Nakamura <upa@haeena.net>2023-03-13 22:35:51 +0900
committerRyo Nakamura <upa@haeena.net>2023-03-13 22:35:51 +0900
commit5f9f20f15006fab8065780eda52f32f14bb3935c (patch)
treee524527cb0994d5905690a457d3292789d0fc410 /include
parentceb9ebd5a8ee6e013cf05b51a5a0ca2aac1ff3ee (diff)
mscp_prepare() scans source paths in a thread.
This commit runs mscp_prepare() in a pthread. mscp copy threads run aysnchronously with mscp_prepare(). So, when mscp_prepare() has not finished yet (due to too many source files), we can start to copy files.
Diffstat (limited to 'include')
-rw-r--r--include/mscp.h13
1 files changed, 12 insertions, 1 deletions
diff --git a/include/mscp.h b/include/mscp.h
index c210881..dcf1ee2 100644
--- a/include/mscp.h
+++ b/include/mscp.h
@@ -155,7 +155,7 @@ int mscp_set_dst_path(struct mscp *m, const char *dst_path);
/**
* @brief Prepare for file transfer. This function checks all source
* files (recursively), resolve paths on the destination side, and
- * calculate file chunks.
+ * calculate file chunks. This function is non-blocking.
*
* @param m mscp instance.
*
@@ -165,6 +165,17 @@ int mscp_set_dst_path(struct mscp *m, const char *dst_path);
int mscp_prepare(struct mscp *m);
/**
+ * @brief Join prepare thread invoked by mscp_prepare(). mscp_join()
+ * involves this, so that mscp_prepare_join() should be called when
+ * mscp_prepare() is called by mscp_start() is not.
+ *
+ * @param m mscp instance.
+ * @return 0 on success, < 0 if an error occured.
+ * mscp_get_error() can be used to retrieve error message.
+ */
+int mscp_prepare_join(struct mscp *m);
+
+/**
* @brief Start to copy files. mscp_start() returns immediately. You
* can get statistics via mscp_get_stats() or messages via pipe set by
* mscp_opts.msg_fd or mscp_set_msg_fd(). mscp_stop() cancels mscp