examples: allow a desianted main thread capacity.
authorHermet Park <chuneon.park@samsung.com>
Wed, 24 Mar 2021 05:19:01 +0000 (14:19 +0900)
committerJunsuChoi <jsuya.choi@samsung.com>
Wed, 24 Mar 2021 05:34:37 +0000 (14:34 +0900)
Maximum threads is not always peak the highest performance,
tvg examples guide user the proper threads count.

33 files changed:
src/examples/AnimateMasking.cpp
src/examples/Arc.cpp
src/examples/Async.cpp
src/examples/Blending.cpp
src/examples/Boundary.cpp
src/examples/ClipPath.cpp
src/examples/CustomTransform.cpp
src/examples/DirectUpdate.cpp
src/examples/Duplicate.cpp
src/examples/FillRule.cpp
src/examples/GradientStroke.cpp
src/examples/GradientTransform.cpp
src/examples/InvMasking.cpp
src/examples/LinearGradient.cpp
src/examples/Masking.cpp
src/examples/MultiCanvas.cpp
src/examples/MultiShapes.cpp
src/examples/Opacity.cpp
src/examples/Path.cpp
src/examples/PathCopy.cpp
src/examples/PixelImage.cpp
src/examples/RadialGradient.cpp
src/examples/Scene.cpp
src/examples/SceneTransform.cpp
src/examples/Shape.cpp
src/examples/Stacking.cpp
src/examples/Stress.cpp
src/examples/Stroke.cpp
src/examples/StrokeLine.cpp
src/examples/Svg.cpp
src/examples/Svg2.cpp
src/examples/Transform.cpp
src/examples/Update.cpp

index 0436385f80c2cdb0f5f8cc214ab99e10e74c7c32..078f91511f7ca5f537997f88607be63066f70e26 100644 (file)
@@ -176,6 +176,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 850ffc84d47f9ad27583663dce44a9bd51c45610..e1bd5e3bab61778096a40411b9b231b54a92230f 100644 (file)
@@ -172,6 +172,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 2b067cf81c5569698f121284fa47571a7a8b5ee1..0ddcd2203d3a670cf8f2f1d2963207aa74e6e832 100644 (file)
@@ -175,6 +175,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 8015e0d35eced27261388c3c47acc20f3c1b0fb9..cd4d2362a6089f916a08758db7aeca8164f5fe40 100644 (file)
@@ -155,6 +155,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 88ca7b97341715464c64b55330c75010d3ee38d6..a42cca2bd8af6cb9a7c9c60094c048d85725be54 100644 (file)
@@ -144,6 +144,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 57e6234ed75843bebc6a6b3118fa29e52a1d02f3..a780b386aa3dc260b3cab2fdd441725d345cbe01 100644 (file)
@@ -235,6 +235,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 9a75e8b9d16301cc624a223e7db40914b69c117a..3c6bdeebe5e1d4f9fb90f866e011f8cbaf7580c0 100644 (file)
@@ -201,6 +201,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index e72d1b6a11e14cf9b35ddd42d63661cb6d76ec78..2ed97bb7db1cb2ae4314fa5f7f137fc9de66fa93 100644 (file)
@@ -174,6 +174,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 1c9333d461f5cbb819f7620cea4af50d5b807ea7..580e3a07f139f1a9b3356825e60b382e9b54e78f 100644 (file)
@@ -222,6 +222,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index dda6f3593b6f159912f1e8e52d4fa92cbcb2369b..8449fa146daca1e5ce1f100530ffad4ee040010c 100644 (file)
@@ -138,6 +138,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 87ccb99b7d210824c19cb9b7b5135c4abbd2ba85..60b81ceab9da29f0276360f47dde10385088bfdf 100644 (file)
@@ -208,6 +208,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index eb46bf14df77c87c4117bc5326e3e2fd6943b257..345bb7d8634d7431433afa0f26635a9bc94e23f9 100644 (file)
@@ -229,6 +229,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 61ab17a10759225ca0fa0dc41fd8170543d4e1ef..ad186553d8c4eda3aeeab5bcd9c89fbff9ef818d 100644 (file)
@@ -195,6 +195,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index fe216318f14f916d247215739473209462d10031..b3bdc8e88f4e7e029b47b739b328b12673449467 100644 (file)
@@ -173,6 +173,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 968ef720f29dfaa43f9ea124dfe37c6bce1dafb0..6140a2b84f2021bd348e9e22776b5e4867ca2f79 100644 (file)
@@ -195,6 +195,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 6bdb642c3fd35447a8b6e0286fe10800ea0f4416..1bd6150ccbe838e37b8971294906ef6e53d21bcb 100644 (file)
@@ -215,6 +215,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 9902604c604f8a9ffbb7e9ec5975a50d6643f5e2..64cc130856ce9111a3a3030ec9473fec7b157f85 100644 (file)
@@ -133,6 +133,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index ff2bf7f5dcb21aab68388d64b9daab4378421b76..35bfc9cfd205c7798408b6c3295649bc84962ff6 100644 (file)
@@ -189,6 +189,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index eaf1ddf817f96418b0bd51b801c5d12a34f25790..535ff9fdf0eaa82ac16d84cf74dd1c0bf9a7e4ec 100644 (file)
@@ -150,6 +150,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 716ab5e09e1358d5babf585a45f7e244ada78680..69281a38cae7def1c2a6380063ca73be9baf6db1 100644 (file)
@@ -187,6 +187,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 72c95dd8cfc95331c376d39ce53bcee685bf56e0..e65087ada7893ebb7fc61b401ee6a25130c8951f 100644 (file)
@@ -154,6 +154,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 3f8dfde27e3e5b881133da7ea225fa1b5c5c2ae9..101e5144c365582ccdc66c0b3308e88ea3ba8934 100644 (file)
@@ -173,6 +173,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index d4a5db354957269d985e1f11f3c89c6f4c0bc8c1..4b047722d964a198f1ea733404367aea14497817 100644 (file)
@@ -180,6 +180,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 2db9de7fa0d889619ff381d3e03d0e9674ad2b63..8272859887aa21fa945a07af178441b6cf1052c8 100644 (file)
@@ -225,6 +225,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 23a949a302628fa440ac95cf641bae7c9c0c7ae0..de6fc4f766c5b0cfea967fb8f00a506167452695 100644 (file)
@@ -123,6 +123,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 871b42f4ae1b65d28c342dd5077c5735485f7917..afae969a64615aaf91f245474a50a014c361f550 100644 (file)
@@ -190,6 +190,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 62041c6f9a1036ea852b8b400fa30eaa2392dde3..862b6afe0c22efdafdc56c8622474cd927a30d9b 100644 (file)
@@ -202,6 +202,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 783efbcf083e9b21e6786956d49d2395c42665d7..4837ace290294ddb5dd8babe23bc153bf8ede6ec 100644 (file)
@@ -181,6 +181,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index c138ecf2ff89612205689814e64c643fc5a11f83..dbc94d60f177e384c9d1174efe98dffd7ff0c918 100644 (file)
@@ -255,6 +255,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 74a30490d75af5d5382b32e10efcb95131d2b18c..33cb98251cbcdc6c50d83eb8dbe0aa70240d5c05 100644 (file)
@@ -163,6 +163,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index f2fc825590edbb40a83fe0f8c67e82f1b0f9b4ca..db82369758bfc306cfba2dc7be27fb7637822a5d 100644 (file)
@@ -130,6 +130,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 3ab896a8f91c57c093e008f5fef79d394ca27b79..2466c301a197fee196ac5955657741df0c757979 100644 (file)
@@ -192,6 +192,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {
index 2875066a11d73db09b249b91ee184261ed4106ae..981e95a1900bca7094dfd8fdde4c017e5f6e3dbd 100644 (file)
@@ -153,6 +153,7 @@ int main(int argc, char **argv)
 
     //Threads Count
     auto threads = std::thread::hardware_concurrency();
+    if (threads > 0) --threads;    //Allow the designated main thread capacity
 
     //Initialize ThorVG Engine
     if (tvg::Initializer::init(tvgEngine, threads) == tvg::Result::Success) {