Merge branch 'master' of https://github.com/sogou/workflow into nossl

This commit is contained in:
Xie Han
2023-12-19 19:38:54 +08:00
2 changed files with 23 additions and 18 deletions
+17 -13
View File
@@ -1039,28 +1039,32 @@ WFConditional *WFTaskFactory::create_guard(const std::string& name,
return __guard_map.create(name, task, msgbuf);
}
void WFTaskFactory::release_guard(const std::string& name, void *msg)
int WFTaskFactory::release_guard(const std::string& name, void *msg)
{
struct __guard_node *node = __guard_map.release(name);
if (node)
node->guard->WFConditional::signal(msg);
if (!node)
return 0;
node->guard->WFConditional::signal(msg);
return 1;
}
void WFTaskFactory::release_guard_safe(const std::string& name, void *msg)
int WFTaskFactory::release_guard_safe(const std::string& name, void *msg)
{
struct __guard_node *node = __guard_map.release(name);
WFTimerTask *timer;
if (node)
{
timer = WFTaskFactory::create_timer_task(0, 0, [](WFTimerTask *timer) {
series_of(timer)->push_front((SubTask *)timer->user_data);
});
timer->user_data = node->guard->get_task();
node->guard->set_task(timer);
node->guard->WFConditional::signal(msg);
}
if (!node)
return 0;
timer = WFTaskFactory::create_timer_task(0, 0, [](WFTimerTask *timer) {
series_of(timer)->push_front((SubTask *)timer->user_data);
});
timer->user_data = node->guard->get_task();
node->guard->set_task(timer);
node->guard->WFConditional::signal(msg);
return 1;
}
/**************** Timed Go Task *****************/
+6 -5
View File
@@ -329,20 +329,21 @@ public:
SubTask *task, void **msgbuf);
/* The 'guard' is acquired after started, so call 'release_guard' after
and only after the task is finished, typically in its callback. */
static void release_guard(const std::string& resource_name)
and only after the task is finished, typically in its callback.
The function returns 1 if another is signaled, otherwise returns 0. */
static int release_guard(const std::string& resource_name)
{
return WFTaskFactory::release_guard(resource_name, NULL);
}
static void release_guard(const std::string& resaource_name, void *msg);
static int release_guard(const std::string& resaource_name, void *msg);
static void release_guard_safe(const std::string& resource_name)
static int release_guard_safe(const std::string& resource_name)
{
return WFTaskFactory::release_guard_safe(resource_name, NULL);
}
static void release_guard_safe(const std::string& resource_name, void *msg);
static int release_guard_safe(const std::string& resource_name, void *msg);
public:
template<class FUNC, class... ARGS>