Skip to content

Commit

Permalink
basic threads, synchronized and Thread Pool
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorA1 committed Apr 23, 2019
1 parent ec7a181 commit 754e3ff
Show file tree
Hide file tree
Showing 42 changed files with 1,123 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Thread1/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Thread1/.idea/description.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Thread1/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Thread1/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions Thread1/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Thread1/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

147 changes: 147 additions & 0 deletions Thread1/.idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions Thread1/Thread1.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Binary file added Thread1/out/production/Thread1/Main.class
Binary file not shown.
Binary file added Thread1/out/production/Thread1/Runner.class
Binary file not shown.
42 changes: 42 additions & 0 deletions Thread1/src/Main.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import java.util.Scanner;

public class Main
{

public static void main(String[] args)
{
Scanner scanner = new Scanner(System.in);
System.out.println("Hello World!");

Runner runner1 = new Runner();
runner1.start();

Runner runner2 = new Runner();
runner2.start();
}
}

class Runner extends Thread
{
private volatile boolean running = true;
public void run()
{
while(running)
{
System.out.println("Hello ");
}

try
{
Thread.sleep(100);
} catch (InterruptedException e)
{
e.printStackTrace();
}
}

public void shutDown()
{
this.running = false;
}
}
23 changes: 23 additions & 0 deletions ThreadPool/.idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ThreadPool/.idea/description.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions ThreadPool/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions ThreadPool/.idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions ThreadPool/.idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions ThreadPool/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 754e3ff

Please sign in to comment.