Skip to content

Create tasks manager to retain tasks #63

@Koshub

Description

@Koshub

Is it possible to retain task while it is executed in one scope? I have found that tasks deinit after creating )) even they are returned from success block of other task. Probably we need something that will retain task while it is executing like in next example:

public class Task<Progress, Value, Error> {

    //...

    class func createTask<Progress, Value, Error>(initClosure: InitClosure) -> Task<Progesss, Value, Error> {
        // Paused
        let task = Task<Progesss, Value, Error>(paused: true, initClosure: initClosure)
        task.onFinish = {
            TasksRegistry.unregister(task) // Release
        }
        TasksRegistry.register(task) // Retain
        return task
    }

    //...
}

Or is there any other ways to do so?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions