Set duration of an interrupt(task) for 10ms

Hello dear Arduino-community,

since I am new to Arduino programming, I would like to ask you a question.
How can I set the duration of task to be 10ms?
I experiment with an interrupt and I would like it to perform for 10ms.

Thank you very much in advance and I wish you a nice weekend

Best regards

Kostas

The code takes as long as needed to run.
In an ISR millis() usually won’t tick, and it’s usually a bad idea to block the main code for a long time (10ms can be a long time)

Tell us more on the need. Feels like a XY problem

You can write your Task using a state machine.

In the state machine look at a Task TIMER (BWD), if it expires, go and do other things then come back after those things have finished executing.

Did this sounded for a tick timer used for an OS, didn´t it?
Take a view to BWOD example of the IDE and build a state and time event driven scheduler based on a array of function pointers.
Have a nice day and enjoy coding in C++.