Skip to content

[question] Transfering work units from a pool to another #383

Description

@mdorier

Assuming I have a pool P1, that I know (1) is not used by any scheduler/xstream at the moment, (2) has no currently running ULT or task that could return to it upon yielding, and (3) will not be used as an argument to ABT_thread_create or other functions, i.e. ULTs that are in the pool are going to stay there and no new ULTs will be pushed or created in that pool.

I want to migrate the content of P1 to a pool P2 (which is in use by a scheduler/xstream, and has MPMC access). Is the following the right way of doing such a migration:

  1. Use ABT_pool_get_size to get the number of ULTs in P1
  2. Use ABT_pool_pop_threads to pop them all out of P1
  3. Use ABT_pool_push_threads to push them to P2

In the above code, should I call ABT_thread_set_associated_pool before pushing the ULTs into P2?

I also see the function ABT_thread_migrate_to_pool. Can it be used to replace 3? I see in the documentation "Request a migration of a work unit to a specific pool.", but nothing about when this migration would happen. In the case of non-running ULTs, would this migration happen immediately?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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