Sebastian Lackner : vcomp: Implement _vcomp_get_thread_num.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Oct 7 10:00:48 CDT 2015


Module: wine
Branch: master
Commit: 0410cf9cbe143720f12c0f8f48e7526a4769cae0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0410cf9cbe143720f12c0f8f48e7526a4769cae0

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Wed Oct  7 05:46:25 2015 +0200

vcomp: Implement _vcomp_get_thread_num.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>

---

 dlls/vcomp/main.c           | 6 ++++++
 dlls/vcomp/tests/vcomp.c    | 7 +++++++
 dlls/vcomp/vcomp.spec       | 2 +-
 dlls/vcomp100/vcomp100.spec | 2 +-
 dlls/vcomp110/vcomp110.spec | 2 +-
 dlls/vcomp90/vcomp90.spec   | 2 +-
 6 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/dlls/vcomp/main.c b/dlls/vcomp/main.c
index d442155..5aa0343 100644
--- a/dlls/vcomp/main.c
+++ b/dlls/vcomp/main.c
@@ -480,6 +480,12 @@ int CDECL omp_get_thread_num(void)
     return vcomp_init_thread_data()->thread_num;
 }
 
+int CDECL _vcomp_get_thread_num(void)
+{
+    TRACE("()\n");
+    return vcomp_init_thread_data()->thread_num;
+}
+
 /* Time in seconds since "some time in the past" */
 double CDECL omp_get_wtime(void)
 {
diff --git a/dlls/vcomp/tests/vcomp.c b/dlls/vcomp/tests/vcomp.c
index 83125e1..4f030d3 100644
--- a/dlls/vcomp/tests/vcomp.c
+++ b/dlls/vcomp/tests/vcomp.c
@@ -65,6 +65,7 @@ static void  (CDECL   *p_vcomp_for_static_init)(int first, int last, int step, i
 static void  (CDECL   *p_vcomp_for_static_simple_init)(unsigned int first, unsigned int last, int step,
                                                        BOOL increment, unsigned int *begin, unsigned int *end);
 static void  (WINAPIV *p_vcomp_fork)(BOOL ifval, int nargs, void *wrapper, ...);
+static int   (CDECL   *p_vcomp_get_thread_num)(void);
 static void  (CDECL   *p_vcomp_leave_critsect)(CRITICAL_SECTION *critsect);
 static int   (CDECL   *p_vcomp_master_begin)(void);
 static void  (CDECL   *p_vcomp_master_end)(void);
@@ -254,6 +255,7 @@ static BOOL init_vcomp(void)
     VCOMP_GET_PROC(_vcomp_for_static_init);
     VCOMP_GET_PROC(_vcomp_for_static_simple_init);
     VCOMP_GET_PROC(_vcomp_fork);
+    VCOMP_GET_PROC(_vcomp_get_thread_num);
     VCOMP_GET_PROC(_vcomp_leave_critsect);
     VCOMP_GET_PROC(_vcomp_master_begin);
     VCOMP_GET_PROC(_vcomp_master_end);
@@ -306,6 +308,8 @@ static void CDECL num_threads_cb(BOOL nested, int parallel, int nested_threads,
     thread_num = pomp_get_thread_num();
     ok(thread_num >= 0 && thread_num < num_threads,
        "expected thread_num in range [0, %d], got %d\n", num_threads - 1, thread_num);
+    ok(thread_num == p_vcomp_get_thread_num(),
+       "expected _vcomp_get_thread_num to return the same value\n");
 
     is_parallel = pomp_in_parallel();
     ok(is_parallel == parallel, "expected %d, got %d\n", parallel, is_parallel);
@@ -344,6 +348,9 @@ static void test_omp_get_num_threads(BOOL nested)
     int is_nested, is_parallel, max_threads, num_threads, thread_num;
     LONG thread_count;
 
+    ok(pomp_get_thread_num != p_vcomp_get_thread_num,
+       "expected omp_get_thread_num != _vcomp_get_thread_num\n");
+
     pomp_set_nested(nested);
     is_nested = pomp_get_nested();
     ok(is_nested == nested, "expected %d, got %d\n", nested, is_nested);
diff --git a/dlls/vcomp/vcomp.spec b/dlls/vcomp/vcomp.spec
index 52b929f..7703e2e 100644
--- a/dlls/vcomp/vcomp.spec
+++ b/dlls/vcomp/vcomp.spec
@@ -65,7 +65,7 @@
 @ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr)
 @ stub _vcomp_for_static_simple_init_i8
 @ varargs _vcomp_fork(long long ptr)
-@ stub _vcomp_get_thread_num
+@ cdecl _vcomp_get_thread_num()
 @ cdecl _vcomp_leave_critsect(ptr)
 @ stub _vcomp_master_barrier
 @ cdecl _vcomp_master_begin()
diff --git a/dlls/vcomp100/vcomp100.spec b/dlls/vcomp100/vcomp100.spec
index 4b646eb..849125f 100644
--- a/dlls/vcomp100/vcomp100.spec
+++ b/dlls/vcomp100/vcomp100.spec
@@ -65,7 +65,7 @@
 @ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr) vcomp._vcomp_for_static_simple_init
 @ stub _vcomp_for_static_simple_init_i8
 @ varargs _vcomp_fork(long long ptr) vcomp._vcomp_fork
-@ stub _vcomp_get_thread_num
+@ cdecl _vcomp_get_thread_num() vcomp._vcomp_get_thread_num
 @ cdecl _vcomp_leave_critsect(ptr) vcomp._vcomp_leave_critsect
 @ stub _vcomp_master_barrier
 @ cdecl _vcomp_master_begin() vcomp._vcomp_master_begin
diff --git a/dlls/vcomp110/vcomp110.spec b/dlls/vcomp110/vcomp110.spec
index 1ee7fba..87a7205 100644
--- a/dlls/vcomp110/vcomp110.spec
+++ b/dlls/vcomp110/vcomp110.spec
@@ -66,7 +66,7 @@
 @ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr) vcomp._vcomp_for_static_simple_init
 @ stub _vcomp_for_static_simple_init_i8
 @ varargs _vcomp_fork(long long ptr) vcomp._vcomp_fork
-@ stub _vcomp_get_thread_num
+@ cdecl _vcomp_get_thread_num() vcomp._vcomp_get_thread_num
 @ cdecl _vcomp_leave_critsect(ptr) vcomp._vcomp_leave_critsect
 @ stub _vcomp_master_barrier
 @ cdecl _vcomp_master_begin() vcomp._vcomp_master_begin
diff --git a/dlls/vcomp90/vcomp90.spec b/dlls/vcomp90/vcomp90.spec
index 4b646eb..849125f 100644
--- a/dlls/vcomp90/vcomp90.spec
+++ b/dlls/vcomp90/vcomp90.spec
@@ -65,7 +65,7 @@
 @ cdecl _vcomp_for_static_simple_init(long long long long ptr ptr) vcomp._vcomp_for_static_simple_init
 @ stub _vcomp_for_static_simple_init_i8
 @ varargs _vcomp_fork(long long ptr) vcomp._vcomp_fork
-@ stub _vcomp_get_thread_num
+@ cdecl _vcomp_get_thread_num() vcomp._vcomp_get_thread_num
 @ cdecl _vcomp_leave_critsect(ptr) vcomp._vcomp_leave_critsect
 @ stub _vcomp_master_barrier
 @ cdecl _vcomp_master_begin() vcomp._vcomp_master_begin




More information about the wine-cvs mailing list