1 /* 2 * %CopyrightBegin% 3 * 4 * Copyright Ericsson AB and Kjell Winblad 2019. All Rights Reserved. 5 * 6 * Licensed under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 * 18 * %CopyrightEnd% 19 */ 20 21 /* 22 * Description: 23 * 24 * Author: Kjell Winblad 25 * 26 */ 27 28 29 #include <stdio.h> 30 #include <stdlib.h> 31 32 #define YCF_YIELD() 33 34 int A(int depth); 35 int B(int depth); 36 A(int depth)37int A(int depth){ 38 int b; 39 YCF_YIELD(); 40 depth++; 41 printf("A "); 42 YCF_YIELD(); 43 if(depth == 100){ 44 return 1; 45 } else { 46 b = B(depth); 47 } 48 YCF_YIELD(); 49 return b + 1; 50 } 51 B(int depth)52int B(int depth){ 53 int a; 54 YCF_YIELD(); 55 depth++; 56 printf("B "); 57 YCF_YIELD(); 58 if(depth == 100){ 59 YCF_YIELD(); 60 return 1; 61 } else { 62 a = A(depth); 63 } 64 YCF_YIELD(); 65 return a + 1; 66 } 67