P
P
parkito2016-04-24 02:46:09
Java
parkito, 2016-04-24 02:46:09

How to run a function in a separate thread?

Hello. Can you please tell me if it is possible to run functions funkA, funkB, funkC in different threads?

public class SmartAlgorithm implements Runnable {
    public static void main(String[] args) {

    }

    public void run() {

    }
    public void run(int c) {

    }

    public void funkA(int a) {
    }

    public void funkB() {
    }

    public void funkC() {
    }
}

The question is caused by the fact that there is a recursive function with parameters, the work of which I would like to parallelize.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Zagaevsky, 2016-04-24
@zagayevskiy

You can use the Fork/Join Framework. There is RecursiveAction and RecursiveTask. Read more here: https://habrahabr.ru/post/128985/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question