diff --git a/ptypes-threads/buid.sh b/ptypes-threads/buid.sh new file mode 100644 index 0000000..463751f --- /dev/null +++ b/ptypes-threads/buid.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +gcc -o main -lptypes main.cpp +./main \ No newline at end of file diff --git a/ptypes-threads/build.bat b/ptypes-threads/build.bat new file mode 100644 index 0000000..fc303b3 --- /dev/null +++ b/ptypes-threads/build.bat @@ -0,0 +1,7 @@ +@echo off +::pushd .. +::set parent=%cd% +::popd +call ../vcppbuild.bat main "/link /LIBPATH:../ext/libs" +main.exe +pause \ No newline at end of file diff --git a/ptypes-threads/main.cpp b/ptypes-threads/main.cpp new file mode 100644 index 0000000..63d4d10 --- /dev/null +++ b/ptypes-threads/main.cpp @@ -0,0 +1,34 @@ +#include +#include + +#pragma comment(lib, "../ext/libs/ptypes.lib") +#pragma comment(lib, "user32.lib") + +USING_PTYPES + +class threadtest : public thread +{ +protected: + virtual void execute(); + virtual void cleanup() { } +public: + threadtest() : thread(false) { } +}; + +void threadtest::execute() +{ + int i; + for(i = 0; i < 10; i++) + printf("%i\n", i); +} + +int main() +{ + threadtest t1, t2; + + t1.start(); + t2.start(); + + t1.waitfor(); + t2.waitfor(); +} \ No newline at end of file diff --git a/vcppbuild.bat b/vcppbuild.bat index c79ef4f..cc28818 100644 --- a/vcppbuild.bat +++ b/vcppbuild.bat @@ -13,5 +13,5 @@ if exist "c:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" ( goto compile ) :compile -cl.exe /clr %1.cpp +cl.exe /clr /D WIN32 /I"..\ext\include" %1.cpp %2 del %1.obj \ No newline at end of file