mirror of https://github.com/BOINC/boinc.git
*** empty log message ***
svn path=/trunk/boinc_samples/; revision=10217
This commit is contained in:
parent
d892b587e8
commit
4782a844a7
|
@ -85,6 +85,9 @@ David 26 May 2006
|
|||
David 29 May 2006
|
||||
- moved wrapper application here from boinc/apps
|
||||
|
||||
win_build
|
||||
sleeper.vcproj
|
||||
wrapper.vcproj
|
||||
wrapper/
|
||||
wrapper.C
|
||||
Makefile
|
||||
|
|
|
@ -28,12 +28,16 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "upper_case", "upper_case.vc
|
|||
{5F065EAC-B881-4E9A-9E34-7A21D7A01D98} = {5F065EAC-B881-4E9A-9E34-7A21D7A01D98}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sleeper", "sleeper.vcproj", "{8281D898-0E64-44EB-8356-4F0336F19A35}"
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wrapper", "wrapper.vcproj", "{8281D898-0E64-44EB-8356-4F0336F19A35}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
{0BC1DB36-030A-4321-B387-1CEE2611E329} = {0BC1DB36-030A-4321-B387-1CEE2611E329}
|
||||
{E8F6BD7E-461A-4733-B7D8-37B09A099ED8} = {E8F6BD7E-461A-4733-B7D8-37B09A099ED8}
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sleeper", "sleeper.vcproj", "{8281D898-0E64-44EB-8356-4F0336F19A35}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
|
@ -68,6 +72,10 @@ Global
|
|||
{8281D898-0E64-44EB-8356-4F0336F19A35}.Debug.Build.0 = Debug|Win32
|
||||
{8281D898-0E64-44EB-8356-4F0336F19A35}.Release.ActiveCfg = Release|Win32
|
||||
{8281D898-0E64-44EB-8356-4F0336F19A35}.Release.Build.0 = Release|Win32
|
||||
{8281D898-0E64-44EB-8356-4F0336F19A35}.Debug.ActiveCfg = Debug|Win32
|
||||
{8281D898-0E64-44EB-8356-4F0336F19A35}.Debug.Build.0 = Debug|Win32
|
||||
{8281D898-0E64-44EB-8356-4F0336F19A35}.Release.ActiveCfg = Release|Win32
|
||||
{8281D898-0E64-44EB-8356-4F0336F19A35}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
|
|
|
@ -0,0 +1,175 @@
|
|||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="wrapper"
|
||||
ProjectGUID="{8281D898-0E64-44EB-8356-4F0336F19A35}"
|
||||
SccProjectName=""
|
||||
SccLocalPath="">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="1"
|
||||
FavorSizeOrSpeed="1"
|
||||
OptimizeForProcessor="3"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
AdditionalIncludeDirectories=".;../../boinc;../../boinc/api;../../boinc/lib;../image_libs;../jpeglib;../glut"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_MT;_CONSOLE"
|
||||
StringPooling="FALSE"
|
||||
RuntimeLibrary="0"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="boinc_win.h"
|
||||
PrecompiledHeaderFile="$(IntDir)/boinc_win.pch"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="3"
|
||||
CompileAs="2"
|
||||
ForcedIncludeFiles="boinc_win.h"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libcmt.lib libcpmt.lib"
|
||||
OutputFile="Release/sleeper_5.10_windows_intelx86.exe"
|
||||
LinkIncremental="0"
|
||||
SuppressStartupBanner="TRUE"
|
||||
IgnoreAllDefaultLibraries="TRUE"
|
||||
DelayLoadDLLs=""
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="Release/uppercase_5.10_windows_intelx86.pdb"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=""
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="0"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=".;../../boinc;../../boinc/api;../../boinc/lib;../image_libs;../jpeglib;../glut"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_MT;_CONSOLE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="1"
|
||||
UsePrecompiledHeader="2"
|
||||
PrecompiledHeaderThrough="boinc_win.h"
|
||||
PrecompiledHeaderFile="$(IntDir)/boinc_win.pch"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"
|
||||
CompileAs="2"
|
||||
ForcedIncludeFiles=""/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="libcmtd.lib libcpmtd.lib kernel32.lib user32.lib gdi32.lib opengl32.lib glu32.lib glaux.lib ole32.lib"
|
||||
OutputFile="Debug/wrapper_5.10_windows_intelx86.exe"
|
||||
LinkIncremental="0"
|
||||
SuppressStartupBanner="TRUE"
|
||||
IgnoreAllDefaultLibraries="TRUE"
|
||||
DelayLoadDLLs="GDI32.DLL;OPENGL32.DLL;GLU32.DLL"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="Debug/uppercase_5.10_windows_intelx86.pdb"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=""
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="1033"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="..\wrapper\wrapper.C">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
|
@ -65,6 +65,7 @@ string application;
|
|||
bool first = true;
|
||||
#ifdef _WIN32
|
||||
HANDLE pid_handle;
|
||||
HANDLE thread_handle;
|
||||
#else
|
||||
int pid;
|
||||
#endif
|
||||
|
@ -129,15 +130,13 @@ void parse_state_file() {
|
|||
}
|
||||
|
||||
int run_application(char** argv) {
|
||||
int retval;
|
||||
|
||||
#ifdef _WIN32
|
||||
PROCESS_INFORMATION process_info;
|
||||
STARTUPINFO startup_info;
|
||||
memset(&process_info, 0, sizeof(process_info));
|
||||
memset(&startup_info, 0, sizeof(startup_info));
|
||||
|
||||
if (!CreateProcess(exec_path,
|
||||
if (!CreateProcess(application.c_str(),
|
||||
(LPSTR)application.c_str(),
|
||||
NULL,
|
||||
NULL,
|
||||
|
@ -150,7 +149,10 @@ int run_application(char** argv) {
|
|||
)) {
|
||||
return ERR_EXEC;
|
||||
}
|
||||
pid_handle = process_info.hProcess;
|
||||
thread_handle = process_info.hThread;
|
||||
#else
|
||||
int retval;
|
||||
char progname[256], buf[256];
|
||||
pid = fork();
|
||||
if (pid == -1) {
|
||||
|
@ -184,8 +186,8 @@ bool poll_application(int& status) {
|
|||
status = stat;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
void kill_app() {
|
||||
|
@ -196,6 +198,22 @@ void kill_app() {
|
|||
#endif
|
||||
}
|
||||
|
||||
void stop_app() {
|
||||
#ifdef _WIN32
|
||||
SuspendThread(thread_handle);
|
||||
#else
|
||||
kill(pid, SIGSTOP);
|
||||
#endif
|
||||
}
|
||||
|
||||
void resume_app() {
|
||||
#ifdef _WIN32
|
||||
ResumeThread(thread_handle);
|
||||
#else
|
||||
kill(pid, SIGCONT);
|
||||
#endif
|
||||
}
|
||||
|
||||
void poll_boinc_messages() {
|
||||
BOINC_STATUS status;
|
||||
boinc_get_status(&status);
|
||||
|
@ -204,21 +222,21 @@ void poll_boinc_messages() {
|
|||
exit(0);
|
||||
}
|
||||
if (status.quit_request) {
|
||||
kill(pid, SIGKILL);
|
||||
kill_app();
|
||||
exit(0);
|
||||
}
|
||||
if (status.abort_request) {
|
||||
kill(pid, SIGKILL);
|
||||
kill_app();
|
||||
exit(0);
|
||||
}
|
||||
if (status.suspended) {
|
||||
if (!app_suspended) {
|
||||
kill(pid, SIGSTOP);
|
||||
stop_app();
|
||||
app_suspended = true;
|
||||
}
|
||||
} else {
|
||||
if (app_suspended) {
|
||||
kill(pid, SIGCONT);
|
||||
resume_app();
|
||||
app_suspended = false;
|
||||
}
|
||||
}
|
||||
|
@ -261,3 +279,16 @@ int main(int argc, char** argv) {
|
|||
boinc_sleep(1.);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR Args, int WinMode) {
|
||||
LPSTR command_line;
|
||||
char* argv[100];
|
||||
int argc;
|
||||
|
||||
command_line = GetCommandLine();
|
||||
argc = parse_command_line( command_line, argv );
|
||||
return main(argc, argv);
|
||||
}
|
||||
#endif
|
Loading…
Reference in New Issue