⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dispatchperformancegittest.java

📁 java 调用windows的api
💻 JAVA
字号:
/*
 * DispatchPerformanceGITTest.java -
 *
 * This file is part of the Jawin Project: http://jawinproject.sourceforge.net/
 * 
 * Please consult the LICENSE file in the project root directory,
 * or at the project site before using this software.
 */

/* $Id: DispatchPerformanceGITTest.java,v 1.2 2004/07/18 15:12:35 arosii_moa Exp $ */

package org.jawin.perf;

import org.jawin.COMException;
import org.jawin.DispatchPtr;
import org.jawin.win32.COINIT;

/**
 * The {@link org.jawin.perf.DispatchPerformanceTestBase}-tests executed
 * through a GIT reference pointer (means this works from several threads,
 * but is a factor 10-50 slower than with a non-threadsafe pointer).
 * 
 * @version     $Revision: 1.2 $
 * @author      Morten Andersen, arosii_moa (at) users.sourceforge.net
 */
public class DispatchPerformanceGITTest extends DispatchPerformanceTestBase {

	private DispatchPtrGITThread constructorThread;
	
	protected DispatchPtr initDisp() throws COMException {
		// create the direct reference in another thread
		constructorThread = new DispatchPtrGITThread();		
		constructorThread.start();
		while (constructorThread.getGitDisp() == null) {
			try {
				Thread.sleep(10); // wait for the other thread to create the references before returning it - 
									// very primitive "sync" mechanism
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}

		return constructorThread.getGitDisp();
	}

	protected void closeDisp(DispatchPtr itf) throws COMException {
		synchronized(constructorThread) {
			constructorThread.notify();
		}
	}
	
	protected COINIT getThreadModel() {
		return COINIT.MULTITHREADED;
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -