core: Don't start new tasks as we're shutting down. #108
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 31m40s
All checks were successful
Build Tilde Friends / Build-All (push) Successful in 31m40s
This commit is contained in:
parent
e7a03e3283
commit
2a5375b1e7
@ -119,6 +119,7 @@ typedef struct _tf_task_t
|
|||||||
bool _trusted;
|
bool _trusted;
|
||||||
bool _one_proc;
|
bool _one_proc;
|
||||||
bool _killed;
|
bool _killed;
|
||||||
|
bool _shutting_down;
|
||||||
char _scriptName[256];
|
char _scriptName[256];
|
||||||
int _global_exception_count;
|
int _global_exception_count;
|
||||||
|
|
||||||
@ -1818,6 +1819,8 @@ JSValue tf_taskstub_kill(tf_taskstub_t* stub);
|
|||||||
|
|
||||||
void tf_task_destroy(tf_task_t* task)
|
void tf_task_destroy(tf_task_t* task)
|
||||||
{
|
{
|
||||||
|
task->_shutting_down = true;
|
||||||
|
|
||||||
while (task->_children)
|
while (task->_children)
|
||||||
{
|
{
|
||||||
for (task_child_node_t* node = task->_children; node; node = node->next)
|
for (task_child_node_t* node = task->_children; node; node = node->next)
|
||||||
@ -2162,6 +2165,11 @@ void tf_task_set_android_service_callbacks(tf_android_start_service_t* start_ser
|
|||||||
s_android_stop_service = stop_service;
|
s_android_stop_service = stop_service;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool tf_task_is_shutting_down(tf_task_t* task)
|
||||||
|
{
|
||||||
|
return task && task->_shutting_down;
|
||||||
|
}
|
||||||
|
|
||||||
tf_android_start_service_t* tf_task_get_android_start_service()
|
tf_android_start_service_t* tf_task_get_android_start_service()
|
||||||
{
|
{
|
||||||
return s_android_start_service;
|
return s_android_start_service;
|
||||||
|
@ -364,4 +364,11 @@ tf_android_stop_service_t* tf_task_get_android_stop_service();
|
|||||||
*/
|
*/
|
||||||
void tf_task_check_jobs(tf_task_t* task);
|
void tf_task_check_jobs(tf_task_t* task);
|
||||||
|
|
||||||
|
/**
|
||||||
|
** Check whether tf_task_destroy has been called already.
|
||||||
|
** @param task The task.
|
||||||
|
** @return true if the task is in the process of shutting down.
|
||||||
|
*/
|
||||||
|
bool tf_task_is_shutting_down(tf_task_t* task);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -125,6 +125,11 @@ static void _tf_taskstub_packetstream_close(void* user_data)
|
|||||||
static JSValue _taskstub_create(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
static JSValue _taskstub_create(JSContext* context, JSValueConst this_val, int argc, JSValueConst* argv)
|
||||||
{
|
{
|
||||||
tf_task_t* parent = tf_task_get(context);
|
tf_task_t* parent = tf_task_get(context);
|
||||||
|
if (parent && tf_task_is_shutting_down(parent))
|
||||||
|
{
|
||||||
|
return JS_UNDEFINED;
|
||||||
|
}
|
||||||
|
|
||||||
tf_taskstub_t* stub = tf_malloc(sizeof(tf_taskstub_t));
|
tf_taskstub_t* stub = tf_malloc(sizeof(tf_taskstub_t));
|
||||||
memset(stub, 0, sizeof(*stub));
|
memset(stub, 0, sizeof(*stub));
|
||||||
stub->_stream = tf_packetstream_create();
|
stub->_stream = tf_packetstream_create();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user