Rate This Document
Findability
Accuracy
Completeness
Readability

kupl_egroup_return

The src egroup returns executors to the dest egroup.

Interface Definition

int kupl_egroup_return(kupl_egroup_h dest, kupl_egroup_h src);

Parameters

Parameter

Type

Description

Input/Output

dest

kupl_egroup_h

egroup to which the executors are returned.

Input/Output

src

kupl_egroup_h

egroup that needs to return the executors.

Input/Output

Return Value

  • Success: size of the dest egroup after the executors are returned
  • Failure: KUPL_ERROR

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h> 
#include "kupl.h" 

int main() 
{ 
    int executor_num = kupl_get_num_executors(); 
    int n1 = executor_num / 2; 
    int n2 = executor_num - executor_num / 2;
    int executors1[n1], executors2[n2]; 
    for (int i =0; i < n1; i++) {
        executors1[i] = i;
    } 
    for (int i =0; i < n2; i++) {
        executors2[i] = i + n1;
    } 
    kupl_egroup_h egroup1 = kupl_egroup_create(executors1, n1); 
    kupl_egroup_h egroup2 = kupl_egroup_create(executors2, n2); 
    printf("egroup2 : %d executors\n", n2); 
    n1 = kupl_egroup_borrow(egroup1, egroup2); 
    n2 = kupl_egroup_return(egroup2, egroup1); 
    printf("egroup2 : %d executors\n", n2); 
    kupl_egroup_destroy(egroup1); 
    kupl_egroup_destroy(egroup2); 
    return 0; 
}

The execution result is as follows:

egroup2 : 2 executors
egroup2 : 4 executors

The preceding example demonstrates how the created egroup1 borrows executors from egroup2 and subsequently returns all executors to egroup2. The execution output prints both the initial executor count and final executor count (after the borrow and return operations) for egroup2, indicating that the kupl_egroup_return function returns all executors of egroup1 to egroup2.