Skip to content

Conversation

@Sla-als
Copy link
Owner

@Sla-als Sla-als commented Apr 12, 2020

No description provided.

@Sla-als
Copy link
Owner Author

Sla-als commented Apr 12, 2020

Нужно ли ставить synchronized у метода run() ?

// 1 поток из первой половин
new Thread(new MyRunnableClass()).start();
// 2 поток из второй половины
new Thread(new MyRunnableClassTwo()).start();
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Эти потоки еще нужно подождать, вызвав join()

}
}

static class MyRunnableClassTwo implements Runnable {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MyRunnableClassTwo похож на MyRunnableClass. Отличие только в индексах для копирования (откуда и куда). Можно в один объединить

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants