½º·¹µå¸¦ 6°³±îÁö Ãß°¡½ÃÄÑ º¸¾ÒÁö¸¸...


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]

±Û¾´ÀÌ :Á¶¿µÈ£ 1999³â 3¿ù 27ÀÏ 22:00:04

In Reply to: ½ÇÇà ȯ°æ¿¡ µû¶ó¼­... posted by À±°æ±¸ on 1999³â 3¿ù 26ÀÏ 13:39:31:

½º·¹µå¸¦ 6°³±îÁö Ãß°¡½ÃÄÑ ½ÇÇàÇÏ¿© º¸¾ÒÁö¸¸
°á°ú´Â ¸¶Âù°¡Áö ÀÔ´Ï´Ù.
ÀÌ·ÐÀûÀ¸·Î´Â À±°æ±¸´ÔÀÇ ÁöÀûÀÌ ¸Â´Ù´Â °ÍÀº ÀÌÇØÇÏÁö¸¸ ½ÇÇè°á°ú°¡ ¾û¶×ÇÏ°Ô ³ª¿À´Ï Ȳ´çÇÕ´Ï´Ù.
Á¦°¡ NT ¸¦ ¼³Ä¡Çϰųª Java 1.2 ¸¦ ¼³Ä¡ÇÒ ¶§ º°´Ù¸¥ option ¼³Á¤À» ÇÑ Àûµµ ¾ø´Âµ¥¿ä...
¸¹¾à ¾î¶°ÇÑ ¼³Á¤ÀÌ ¿µÇâÀ» ÁØ´Ù¸é ±×°ÍÀÇ ¿äÀÎÀ» ã¾Æ ³»´Â °Íµµ Áß¿äÇÏ´Ù°í º¾´Ï´Ù.
Ȥ ÀÌ Post ¸¦ ÀÐÀ¸½Å ºÐµéÁß¿¡ NT ȯ°æ¿¡¼­ »ç¿ëÇÏ°í
°è½Ã´Â ºÐµé °è½Ã¸é Test ÇÏ¿© ÁÖ½Ã¸é °¨»çÇÏ°Ú½À´Ï´Ù.


-- ¼Ò½º --
/**
* LockTest.java
* Copyright (c) 1998 Yoon Kyung Koo. All rights reserved.
*
* First release date 1998/09/16
*
* @version 1.0 1998/09/16
* @author <A HREF="mailto:yoonforh@nuri.net">Yoon Kyung Koo</A>
*/


import java.io.*;


class LockTest implements Runnable {
RandomAccessFile raf=null;
LockTest() {
try {
raf=new RandomAccessFile("result.txt", "rw");
} catch (IOException ie) {
System.err.println("IOException:"+ie.getMessage());
return;
}
Thread thread1=new Thread(this);
thread1.setName("FirstThread");
thread1.start();
Thread thread2=new Thread(this);
thread2.setName("SecondThread");
thread2.start();
Thread thread3=new Thread(this);
thread3.setName("ThirdThread");
thread3.start();
Thread thread4=new Thread(this);
thread4.setName("forthThread");
thread4.start();
Thread thread5=new Thread(this);
thread5.setName("fifthThread");
thread5.start();
Thread thread6=new Thread(this);
thread6.setName("sixthThread");
thread6.start();
}


public static void main(String args[]) {
new LockTest();
}
// thread class's lifetime
public void run() {
try {
for (int i=0; i<10; i++) {
raf.writeBytes(Thread.currentThread().getName()
+":["+i+"]"
+raf.getFilePointer()
+"\n");
}
} catch (IOException ie) {
ie.printStackTrace();
}
}


}





´ÙÀ½ ±Ûµé:



À̾ ±Û¿Ã¸®±â(´äÇϱâ)

À̸§:
E-Mail:
Á¦¸ñ:
³»¿ë:
HTML ÅÂ±× Æ÷ÇÔ ¿©ºÎ: HTML ¹®¼­ÀÏ °æ¿ì üũ
°ü·Ã URL(¼±ÅÃ):
URL Á¦¸ñ(¼±ÅÃ):
°ü·Ã À̹ÌÁö URL:


[ ´ÙÀ½ ±Ûµé ] [ À̾ ±Û¿Ã¸®±â(´äÇϱâ) ] [ ÀÚ¹Ù ¹¯°í ´äÇϱâ ]