C++, no locks
\nclass ZeroEvenOdd {\nprivate:\n    int n;\n    function<void(int)> printZero, printEven;\npublic:\n    ZeroEvenOdd(int n) {\n        this->n = n;\n    }\n\n  
```\nclass ZeroEvenOdd {\nprivate:\n    int n;\n    function<void(int)> printZero, printEven;\npublic:\n    ZeroEvenOdd(int n) {\n        this->n = n;\n    }\n\n    void zero(function<void(int)> printNumber) {\n        printZero = printNumber;\n    }\n\n    void even(function<void(int)> printNumber) {\n        printEven = printNumber;\n    }\n\n    void odd(function<void(int)> printNumber) {\n        for (int i = 1; i <=n;)\n        {\n            printZero(0);\n            printNumber(i++);\n            if (i <= n)\n            {\n                printZero(0);\n                printEven(i++);\n            }\n        }\n    }\n};\n```
[]