Thread 간에 서로 얼마자 자주 interupt 가 일어나는지를 알 수 있는 샘플 코드이다. 두개의 thread가 화면에 점과 대쉬를 표시한다. 결과 화면을 보면 인터럽트의 정도를 확인할 수 있다. using System; using System.Threading; namespace ThreadSample { class Program { public const int Repetitions = 1000; static void Main(string[] args) { ThreadStart myThreadStart = new ThreadStart(DoWork); Thread myThread = new Thread(myThreadStart); myThread.Start(); for (int count = 0;..
이 예제는 앞의 예제를 약간 변형한 것이다. Thread와 FileStream을 동시에 사용해보았다. FileStream 에서 FileMode.Append, FileAccess.Write, FileShare.Write 를 사용해서 복수개의 Thread가 File에 접근할 수 있도록했다. FileShare.Write 옵션을 사용하지 않으면, Exception이 발생한다. 이 부분을 이해하는 것이 중요하다. 아래는 코드이다. using System; using System.Threading; using System.IO; using System.Text; public class NameUsingThread { private int time; private Thread thread; public NameUsi..
Thread에 관한 3번째 샘플 코드이다. 이 샘플 코드는 Thread를 3개 실행 시키는 것이다. using System; using System.Threading; public class NameUsingThread { private int time; private Thread thread; public NameUsingThread(String n, int t) { time = t; thread = new Thread(new ThreadStart(Run)); thread.Name = n; thread.Start(); } public void Run() { for (int i = 1; i
- Total
- Today
- Yesterday
- WinAutomation
- Sample Code
- 애드센스숨기기
- AdSense숨기기
- Regular Expressions
- Automation
- Service pack
- DotNetMagic
- java
- 스크린캡쳐
- ScreenHunter
- iText
- READYSTATE_COMPLETE
- tagREADYSTATE
- iTextSharp
- Rollback Rx
- download.com
- AxWebBrowser
- Phalanger
- autohotkey
- c#
- windows
- Microsoft
- 애드센스감추기
- .net framework
- jre
- 유틸리티
- AdSense감추기
- registry
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |