ts_slog_thread2.java
来自「MPICH是MPI的重要研究,提供了一系列的接口函数,为并行计算的实现提供了编程」· Java 代码 · 共 64 行
JAVA
64 行
import java.io.*;public class ts_slog_thread2{ String filename = "slogfile.data"; SLOG_Thread slogth; public ts_slog_thread2() throws IOException { slogth = new SLOG_Thread( filename ); Runnable doReadHdr = new Runnable() { public void run() { try { slogth.ReadIstm(); } catch ( IOException err ) { System.out.println( "slogth.ReadIstm() has IO err" ); } } }; Runnable doPrint = new Runnable() { public void run() { System.out.println( slogth.toString() ); } }; Runnable doReadFrames = new Runnable() { public void run() { for ( int idx = 0; idx < slogth.NumOfFrames(); idx++ ) { if ( idx % 2 == 0 ) { try { slogth.ReadFrame( idx ); System.out.println( "SLOG_Frame No. " + idx + ": \n" ); System.out.println( slogth.toString() ); } catch ( IOException err ) { System.out.println( "slogth.ReadFrame() has IO err" ); } } } } }; Thread slog_readframes = new Thread( doReadFrames ); slog_readframes.start(); Thread slog_init = new Thread( doReadHdr ); slog_init.start(); Thread slog_print = new Thread( doPrint ); slog_print.start(); } public static void main( String argv[] ) throws IOException { ts_slog_thread2 pgm = new ts_slog_thread2(); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?