mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-18 03:40:47 -08:00
New header testthr.h provides simple threading interface.
Implementations testthrix.c for Unix and testthrw3.c for Windows. Multi-threaded test cases use the new interface. Rename lockutw3 to lockut (no longer Windows-specific). Run multi-threaded test cases on Windows and lockut elsewhere. Copied from Perforce Change: 185350 ServerID: perforce.ravenbrook.com
This commit is contained in:
parent
9a57106d49
commit
e45793ce57
14 changed files with 451 additions and 88 deletions
|
|
@ -12,11 +12,11 @@
|
||||||
#include "fmtdy.h"
|
#include "fmtdy.h"
|
||||||
#include "fmtdytst.h"
|
#include "fmtdytst.h"
|
||||||
#include "testlib.h"
|
#include "testlib.h"
|
||||||
|
#include "testthr.h"
|
||||||
#include "mpslib.h"
|
#include "mpslib.h"
|
||||||
#include "mpscamc.h"
|
#include "mpscamc.h"
|
||||||
#include "mpsavm.h"
|
#include "mpsavm.h"
|
||||||
|
|
||||||
#include <pthread.h> /* pthread_create, pthread_join */
|
|
||||||
#include <stdio.h> /* fflush, printf, putchar */
|
#include <stdio.h> /* fflush, printf, putchar */
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -219,7 +219,7 @@ static void *test(mps_class_t pool_class, size_t roots_count)
|
||||||
mps_ap_t ap, busy_ap;
|
mps_ap_t ap, busy_ap;
|
||||||
mps_addr_t busy_init;
|
mps_addr_t busy_init;
|
||||||
mps_pool_t pool;
|
mps_pool_t pool;
|
||||||
pthread_t kids[10];
|
testthr_t kids[10];
|
||||||
closure_s cl;
|
closure_s cl;
|
||||||
|
|
||||||
die(mps_pool_create(&pool, arena, pool_class, format, chain),
|
die(mps_pool_create(&pool, arena, pool_class, format, chain),
|
||||||
|
|
@ -228,11 +228,8 @@ static void *test(mps_class_t pool_class, size_t roots_count)
|
||||||
cl.pool = pool;
|
cl.pool = pool;
|
||||||
cl.roots_count = roots_count;
|
cl.roots_count = roots_count;
|
||||||
|
|
||||||
for (i = 0; i < sizeof(kids)/sizeof(kids[0]); ++i) {
|
for (i = 0; i < sizeof(kids)/sizeof(kids[0]); ++i)
|
||||||
int err = pthread_create(&kids[i], NULL, kid_thread, &cl);
|
testthr_create(&kids[i], kid_thread, &cl);
|
||||||
if (err != 0)
|
|
||||||
error("pthread_create returned %d", err);
|
|
||||||
}
|
|
||||||
|
|
||||||
die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate");
|
die(mps_ap_create(&ap, pool, mps_rank_exact()), "BufferCreate");
|
||||||
die(mps_ap_create(&busy_ap, pool, mps_rank_exact()), "BufferCreate 2");
|
die(mps_ap_create(&busy_ap, pool, mps_rank_exact()), "BufferCreate 2");
|
||||||
|
|
@ -312,11 +309,8 @@ static void *test(mps_class_t pool_class, size_t roots_count)
|
||||||
mps_ap_destroy(busy_ap);
|
mps_ap_destroy(busy_ap);
|
||||||
mps_ap_destroy(ap);
|
mps_ap_destroy(ap);
|
||||||
|
|
||||||
for (i = 0; i < sizeof(kids)/sizeof(kids[0]); ++i) {
|
for (i = 0; i < sizeof(kids)/sizeof(kids[0]); ++i)
|
||||||
int err = pthread_join(kids[i], NULL);
|
testthr_join(&kids[i], NULL);
|
||||||
if (err != 0)
|
|
||||||
error("pthread_join returned %d", err);
|
|
||||||
}
|
|
||||||
|
|
||||||
mps_pool_destroy(pool);
|
mps_pool_destroy(pool);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,11 @@
|
||||||
#include "mpsavm.h"
|
#include "mpsavm.h"
|
||||||
#include "fmtdy.h"
|
#include "fmtdy.h"
|
||||||
#include "testlib.h"
|
#include "testlib.h"
|
||||||
|
#include "testthr.h"
|
||||||
#include "mpslib.h"
|
#include "mpslib.h"
|
||||||
#include "mps.h"
|
#include "mps.h"
|
||||||
#include "mpstd.h"
|
#include "mpstd.h"
|
||||||
|
|
||||||
#include <pthread.h> /* pthread_create, pthread_join */
|
|
||||||
#include <stdio.h> /* printf, puts */
|
#include <stdio.h> /* printf, puts */
|
||||||
#include <string.h> /* strlen */
|
#include <string.h> /* strlen */
|
||||||
|
|
||||||
|
|
@ -311,7 +311,7 @@ static void *setup_thr(void *v)
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
mps_arena_t arena;
|
mps_arena_t arena;
|
||||||
pthread_t pthread1;
|
testthr_t thread1;
|
||||||
|
|
||||||
testlib_init(argc, argv);
|
testlib_init(argc, argv);
|
||||||
|
|
||||||
|
|
@ -321,9 +321,9 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE),
|
die(mps_arena_create(&arena, mps_arena_class_vm(), testArenaSIZE),
|
||||||
"arena_create\n");
|
"arena_create\n");
|
||||||
pthread_create(&pthread1, NULL, setup_thr, (void *)arena);
|
testthr_create(&thread1, setup_thr, arena);
|
||||||
setup_thr(arena);
|
setup_thr(arena);
|
||||||
pthread_join(pthread1, NULL);
|
testthr_join(&thread1, NULL);
|
||||||
mps_arena_destroy(arena);
|
mps_arena_destroy(arena);
|
||||||
|
|
||||||
printf("%s: Conclusion: Failed to find any defects.\n", argv[0]);
|
printf("%s: Conclusion: Failed to find any defects.\n", argv[0]);
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ SNC = poolsnc.c
|
||||||
POOLN = pooln.c
|
POOLN = pooln.c
|
||||||
MV2 = poolmv2.c
|
MV2 = poolmv2.c
|
||||||
MVFF = poolmvff.c
|
MVFF = poolmvff.c
|
||||||
TESTLIB = testlib.c
|
TESTLIB = testlib.c testthr.c
|
||||||
FMTDY = fmtdy.c fmtno.c
|
FMTDY = fmtdy.c fmtno.c
|
||||||
FMTDYTST = fmtdy.c fmtno.c fmtdytst.c
|
FMTDYTST = fmtdy.c fmtno.c fmtdytst.c
|
||||||
FMTHETST = fmthe.c fmtdy.c fmtno.c fmtdytst.c
|
FMTHETST = fmthe.c fmtdy.c fmtno.c fmtdytst.c
|
||||||
|
|
@ -252,6 +252,7 @@ TEST_TARGETS=\
|
||||||
gcbench \
|
gcbench \
|
||||||
locbwcss \
|
locbwcss \
|
||||||
lockcov \
|
lockcov \
|
||||||
|
lockut \
|
||||||
locusss \
|
locusss \
|
||||||
locv \
|
locv \
|
||||||
messtest \
|
messtest \
|
||||||
|
|
@ -442,6 +443,9 @@ $(PFM)/$(VARIETY)/locbwcss: $(PFM)/$(VARIETY)/locbwcss.o \
|
||||||
$(PFM)/$(VARIETY)/lockcov: $(PFM)/$(VARIETY)/lockcov.o \
|
$(PFM)/$(VARIETY)/lockcov: $(PFM)/$(VARIETY)/lockcov.o \
|
||||||
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
|
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
|
||||||
|
|
||||||
|
$(PFM)/$(VARIETY)/lockut: $(PFM)/$(VARIETY)/lockut.o \
|
||||||
|
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
|
||||||
|
|
||||||
$(PFM)/$(VARIETY)/locusss: $(PFM)/$(VARIETY)/locusss.o \
|
$(PFM)/$(VARIETY)/locusss: $(PFM)/$(VARIETY)/locusss.o \
|
||||||
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
|
$(TESTLIBOBJ) $(PFM)/$(VARIETY)/mps.a
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# commpost.nmk: SECOND COMMON FRAGMENT FOR PLATFORMS USING NMAKE -*- makefile -*-
|
# commpost.nmk: SECOND COMMON FRAGMENT FOR PLATFORMS USING NMAKE -*- makefile -*-
|
||||||
#
|
#
|
||||||
# $Id$
|
# $Id$
|
||||||
# Copyright (c) 2001-2013 Ravenbrook Limited. See end of file for license.
|
# Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||||
#
|
#
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
#
|
#
|
||||||
|
|
@ -146,6 +146,10 @@ $(PFM)\$(VARIETY)\awluthe.exe: $(PFM)\$(VARIETY)\awluthe.obj \
|
||||||
$(FMTTESTOBJ) \
|
$(FMTTESTOBJ) \
|
||||||
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
||||||
|
|
||||||
|
$(PFM)\$(VARIETY)\awlutth.exe: $(PFM)\$(VARIETY)\awlutth.obj \
|
||||||
|
$(FMTTESTOBJ) \
|
||||||
|
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
||||||
|
|
||||||
$(PFM)\$(VARIETY)\btcv.exe: $(PFM)\$(VARIETY)\btcv.obj \
|
$(PFM)\$(VARIETY)\btcv.exe: $(PFM)\$(VARIETY)\btcv.obj \
|
||||||
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
||||||
|
|
||||||
|
|
@ -155,6 +159,9 @@ $(PFM)\$(VARIETY)\bttest.exe: $(PFM)\$(VARIETY)\bttest.obj \
|
||||||
$(PFM)\$(VARIETY)\cvmicv.exe: $(PFM)\$(VARIETY)\cvmicv.obj \
|
$(PFM)\$(VARIETY)\cvmicv.exe: $(PFM)\$(VARIETY)\cvmicv.obj \
|
||||||
$(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ)
|
$(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ)
|
||||||
|
|
||||||
|
$(PFM)\$(VARIETY)\djbench.exe: $(PFM)\$(VARIETY)\djbench.obj \
|
||||||
|
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
||||||
|
|
||||||
$(PFM)\$(VARIETY)\exposet0.exe: $(PFM)\$(VARIETY)\exposet0.obj \
|
$(PFM)\$(VARIETY)\exposet0.exe: $(PFM)\$(VARIETY)\exposet0.obj \
|
||||||
$(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ)
|
$(PFM)\$(VARIETY)\mps.lib $(FMTTESTOBJ) $(TESTLIBOBJ)
|
||||||
|
|
||||||
|
|
@ -173,13 +180,16 @@ $(PFM)\$(VARIETY)\finaltest.exe: $(PFM)\$(VARIETY)\finaltest.obj \
|
||||||
$(PFM)\$(VARIETY)\fotest.exe: $(PFM)\$(VARIETY)\fotest.obj \
|
$(PFM)\$(VARIETY)\fotest.exe: $(PFM)\$(VARIETY)\fotest.obj \
|
||||||
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
||||||
|
|
||||||
|
$(PFM)\$(VARIETY)\gcbench.exe: $(PFM)\$(VARIETY)\gcbench.obj \
|
||||||
|
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
||||||
|
|
||||||
$(PFM)\$(VARIETY)\locbwcss.exe: $(PFM)\$(VARIETY)\locbwcss.obj \
|
$(PFM)\$(VARIETY)\locbwcss.exe: $(PFM)\$(VARIETY)\locbwcss.obj \
|
||||||
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
||||||
|
|
||||||
$(PFM)\$(VARIETY)\lockcov.exe: $(PFM)\$(VARIETY)\lockcov.obj \
|
$(PFM)\$(VARIETY)\lockcov.exe: $(PFM)\$(VARIETY)\lockcov.obj \
|
||||||
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
||||||
|
|
||||||
$(PFM)\$(VARIETY)\lockutw3.exe: $(PFM)\$(VARIETY)\lockutw3.obj \
|
$(PFM)\$(VARIETY)\lockut.exe: $(PFM)\$(VARIETY)\lockut.obj \
|
||||||
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
$(PFM)\$(VARIETY)\mps.lib $(TESTLIBOBJ)
|
||||||
|
|
||||||
$(PFM)\$(VARIETY)\locusss.exe: $(PFM)\$(VARIETY)\locusss.obj \
|
$(PFM)\$(VARIETY)\locusss.exe: $(PFM)\$(VARIETY)\locusss.obj \
|
||||||
|
|
@ -306,7 +316,7 @@ $(PFM)\$(VARIETY)\sqlite3.obj:
|
||||||
|
|
||||||
# C. COPYRIGHT AND LICENSE
|
# C. COPYRIGHT AND LICENSE
|
||||||
#
|
#
|
||||||
# Copyright (C) 2001-2013 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
# Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||||
# All rights reserved. This is an open source license. Contact
|
# All rights reserved. This is an open source license. Contact
|
||||||
# Ravenbrook for commercial licensing options.
|
# Ravenbrook for commercial licensing options.
|
||||||
#
|
#
|
||||||
|
|
|
||||||
|
|
@ -58,23 +58,27 @@ TEST_TARGETS=\
|
||||||
airtest.exe \
|
airtest.exe \
|
||||||
amcss.exe \
|
amcss.exe \
|
||||||
amcsshe.exe \
|
amcsshe.exe \
|
||||||
|
amcssth.exe \
|
||||||
amsss.exe \
|
amsss.exe \
|
||||||
amssshe.exe \
|
amssshe.exe \
|
||||||
apss.exe \
|
apss.exe \
|
||||||
arenacv.exe \
|
arenacv.exe \
|
||||||
awlut.exe \
|
awlut.exe \
|
||||||
awluthe.exe \
|
awluthe.exe \
|
||||||
|
awlutth.exe \
|
||||||
btcv.exe \
|
btcv.exe \
|
||||||
bttest.exe \
|
bttest.exe \
|
||||||
|
djbench.exe \
|
||||||
exposet0.exe \
|
exposet0.exe \
|
||||||
expt825.exe \
|
expt825.exe \
|
||||||
fbmtest.exe \
|
fbmtest.exe \
|
||||||
finalcv.exe \
|
finalcv.exe \
|
||||||
finaltest.exe \
|
finaltest.exe \
|
||||||
fotest.exe \
|
fotest.exe \
|
||||||
|
gcbench.exe \
|
||||||
locbwcss.exe \
|
locbwcss.exe \
|
||||||
lockcov.exe \
|
lockcov.exe \
|
||||||
lockutw3.exe \
|
lockut.exe \
|
||||||
locusss.exe \
|
locusss.exe \
|
||||||
locv.exe \
|
locv.exe \
|
||||||
messtest.exe \
|
messtest.exe \
|
||||||
|
|
@ -176,7 +180,7 @@ SNC = <poolsnc>
|
||||||
DW = <fmtdy> <fmtno>
|
DW = <fmtdy> <fmtno>
|
||||||
FMTTEST = <fmthe> <fmtdy> <fmtno> <fmtdytst>
|
FMTTEST = <fmthe> <fmtdy> <fmtno> <fmtdytst>
|
||||||
FMTSCHEME = <fmtscheme>
|
FMTSCHEME = <fmtscheme>
|
||||||
TESTLIB = <testlib>
|
TESTLIB = <testlib> <testthrw3>
|
||||||
|
|
||||||
|
|
||||||
# CHECK PARAMETERS
|
# CHECK PARAMETERS
|
||||||
|
|
|
||||||
|
|
@ -13,12 +13,9 @@
|
||||||
|
|
||||||
#include "mps.c"
|
#include "mps.c"
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
#include "testlib.h"
|
#include "testlib.h"
|
||||||
|
#include "testthr.h"
|
||||||
|
|
||||||
|
|
||||||
#define DJMUST(expr) \
|
#define DJMUST(expr) \
|
||||||
|
|
@ -135,24 +132,14 @@ typedef void *(*dj_t)(void *);
|
||||||
|
|
||||||
static void weave(dj_t dj)
|
static void weave(dj_t dj)
|
||||||
{
|
{
|
||||||
pthread_t *threads = alloca(sizeof(threads[0]) * nthreads);
|
testthr_t *threads = alloca(sizeof(threads[0]) * nthreads);
|
||||||
unsigned t;
|
unsigned t;
|
||||||
|
|
||||||
for (t = 0; t < nthreads; ++t) {
|
for (t = 0; t < nthreads; ++t)
|
||||||
int err = pthread_create(&threads[t], NULL, dj, NULL);
|
testthr_create(&threads[t], dj, NULL);
|
||||||
if (err != 0) {
|
|
||||||
fprintf(stderr, "Unable to create thread: %d\n", err);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (t = 0; t < nthreads; ++t) {
|
for (t = 0; t < nthreads; ++t)
|
||||||
int err = pthread_join(threads[t], NULL);
|
testthr_join(&threads[t], NULL);
|
||||||
if (err != 0) {
|
|
||||||
fprintf(stderr, "Unable to join thread: %d\n", err);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,15 +7,9 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "mps.c"
|
#include "mps.c"
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
#include "getopt.h"
|
#include "getopt.h"
|
||||||
#include "testlib.h"
|
#include "testlib.h"
|
||||||
|
#include "testthr.h"
|
||||||
#include "fmtdy.h"
|
#include "fmtdy.h"
|
||||||
#include "fmtdytst.h"
|
#include "fmtdytst.h"
|
||||||
|
|
||||||
|
|
@ -56,7 +50,7 @@ typedef struct gcthread_s *gcthread_t;
|
||||||
typedef void *(*gcthread_fn_t)(gcthread_t thread);
|
typedef void *(*gcthread_fn_t)(gcthread_t thread);
|
||||||
|
|
||||||
struct gcthread_s {
|
struct gcthread_s {
|
||||||
pthread_t pthread;
|
testthr_t thread;
|
||||||
mps_thr_t mps_thread;
|
mps_thr_t mps_thread;
|
||||||
mps_root_t reg_root;
|
mps_root_t reg_root;
|
||||||
mps_ap_t ap;
|
mps_ap_t ap;
|
||||||
|
|
@ -189,23 +183,12 @@ static void weave(gcthread_fn_t fn)
|
||||||
|
|
||||||
for (t = 0; t < nthreads; ++t) {
|
for (t = 0; t < nthreads; ++t) {
|
||||||
gcthread_t thread = &threads[t];
|
gcthread_t thread = &threads[t];
|
||||||
int err;
|
|
||||||
thread->fn = fn;
|
thread->fn = fn;
|
||||||
err = pthread_create(&thread->pthread, NULL, start, thread);
|
testthr_create(&thread->thread, start, thread);
|
||||||
if (err != 0) {
|
|
||||||
fprintf(stderr, "Unable to create thread: %d\n", err);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (t = 0; t < nthreads; ++t) {
|
for (t = 0; t < nthreads; ++t)
|
||||||
gcthread_t thread = &threads[t];
|
testthr_join(&threads[t].thread, NULL);
|
||||||
int err = pthread_join(thread->pthread, NULL);
|
|
||||||
if (err != 0) {
|
|
||||||
fprintf(stderr, "Unable to join thread: %d\n", err);
|
|
||||||
exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void weave1(gcthread_fn_t fn)
|
static void weave1(gcthread_fn_t fn)
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,15 @@
|
||||||
/* lockutw3.c: LOCK UTILIZATION TEST
|
/* lockut.c: LOCK UTILIZATION TEST
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdlib.h> /* malloc */
|
|
||||||
|
|
||||||
#include "mpm.h"
|
#include "mpm.h"
|
||||||
#include "testlib.h"
|
#include "testlib.h"
|
||||||
#include "mpslib.h"
|
#include "testthr.h"
|
||||||
|
|
||||||
#include "mpswin.h"
|
#include <stdio.h> /* printf */
|
||||||
|
#include <stdlib.h> /* malloc */
|
||||||
|
|
||||||
#ifndef MPS_OS_W3
|
|
||||||
#error "Relies on Win32 threads"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
#define nTHREADS 4
|
#define nTHREADS 4
|
||||||
|
|
@ -24,7 +18,7 @@ static Lock lock;
|
||||||
unsigned long shared, tmp;
|
unsigned long shared, tmp;
|
||||||
|
|
||||||
|
|
||||||
void incR(unsigned long i)
|
static void incR(unsigned long i)
|
||||||
{
|
{
|
||||||
LockClaimRecursive(lock);
|
LockClaimRecursive(lock);
|
||||||
if (i < 100) {
|
if (i < 100) {
|
||||||
|
|
@ -40,7 +34,7 @@ void incR(unsigned long i)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void inc(unsigned long i)
|
static void inc(unsigned long i)
|
||||||
{
|
{
|
||||||
incR( (i+1) >>1);
|
incR( (i+1) >>1);
|
||||||
i >>= 1;
|
i >>= 1;
|
||||||
|
|
@ -59,18 +53,17 @@ void inc(unsigned long i)
|
||||||
|
|
||||||
|
|
||||||
#define COUNT 100000l
|
#define COUNT 100000l
|
||||||
DWORD WINAPI thread0(void *p)
|
static void *thread0(void *p)
|
||||||
{
|
{
|
||||||
(void)p;
|
testlib_unused(p);
|
||||||
inc(COUNT);
|
inc(COUNT);
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
DWORD id;
|
testthr_t t[10];
|
||||||
HANDLE t[10];
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
testlib_init(argc, argv);
|
testlib_init(argc, argv);
|
||||||
|
|
@ -84,12 +77,10 @@ int main(int argc, char *argv[])
|
||||||
shared = 0;
|
shared = 0;
|
||||||
|
|
||||||
for(i = 0; i < nTHREADS; i++)
|
for(i = 0; i < nTHREADS; i++)
|
||||||
t[i] = CreateThread(NULL, 0, thread0, NULL, 0, &id);
|
testthr_create(&t[i], thread0, NULL);
|
||||||
|
|
||||||
for(i = 0; i < nTHREADS; i++) {
|
for(i = 0; i < nTHREADS; i++)
|
||||||
cdie(WaitForSingleObject(t[i], INFINITE) == WAIT_OBJECT_0,
|
testthr_join(&t[i], NULL);
|
||||||
"WaitForSingleObject");
|
|
||||||
}
|
|
||||||
|
|
||||||
Insist(shared == nTHREADS*COUNT);
|
Insist(shared == nTHREADS*COUNT);
|
||||||
|
|
||||||
|
|
@ -50,6 +50,7 @@
|
||||||
22B2BC3F18B643B700C33E63 /* PBXTargetDependency */,
|
22B2BC3F18B643B700C33E63 /* PBXTargetDependency */,
|
||||||
2231BB6D18CA986B002D6322 /* PBXTargetDependency */,
|
2231BB6D18CA986B002D6322 /* PBXTargetDependency */,
|
||||||
31D60034156D3D5A00337B26 /* PBXTargetDependency */,
|
31D60034156D3D5A00337B26 /* PBXTargetDependency */,
|
||||||
|
2286E4C918F4389E004111E2 /* PBXTargetDependency */,
|
||||||
2231BB6F18CA986D002D6322 /* PBXTargetDependency */,
|
2231BB6F18CA986D002D6322 /* PBXTargetDependency */,
|
||||||
3114A5A0156E915A001E0AA3 /* PBXTargetDependency */,
|
3114A5A0156E915A001E0AA3 /* PBXTargetDependency */,
|
||||||
3114A6A7156E9739001E0AA3 /* PBXTargetDependency */,
|
3114A6A7156E9739001E0AA3 /* PBXTargetDependency */,
|
||||||
|
|
@ -88,6 +89,10 @@
|
||||||
224CC793175E1821002FF81B /* libmps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31EEABFB156AAF9D00714D05 /* libmps.a */; };
|
224CC793175E1821002FF81B /* libmps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31EEABFB156AAF9D00714D05 /* libmps.a */; };
|
||||||
224CC79F175E321C002FF81B /* mv2test.c in Sources */ = {isa = PBXBuildFile; fileRef = 3114A686156E9674001E0AA3 /* mv2test.c */; };
|
224CC79F175E321C002FF81B /* mv2test.c in Sources */ = {isa = PBXBuildFile; fileRef = 3114A686156E9674001E0AA3 /* mv2test.c */; };
|
||||||
224CC7A0175E322C002FF81B /* fotest.c in Sources */ = {isa = PBXBuildFile; fileRef = 224CC79E175E3202002FF81B /* fotest.c */; };
|
224CC7A0175E322C002FF81B /* fotest.c in Sources */ = {isa = PBXBuildFile; fileRef = 224CC79E175E3202002FF81B /* fotest.c */; };
|
||||||
|
22561A9818F4265D00372C66 /* testthrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22561A9718F4263300372C66 /* testthrix.c */; };
|
||||||
|
22561A9918F4266600372C66 /* testthrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22561A9718F4263300372C66 /* testthrix.c */; };
|
||||||
|
22561A9A18F426BB00372C66 /* testthrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22561A9718F4263300372C66 /* testthrix.c */; };
|
||||||
|
22561A9B18F426F300372C66 /* testthrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22561A9718F4263300372C66 /* testthrix.c */; };
|
||||||
2291A5B1175CAB2F001D4920 /* fmtdy.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAC6156BE48D00753214 /* fmtdy.c */; };
|
2291A5B1175CAB2F001D4920 /* fmtdy.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAC6156BE48D00753214 /* fmtdy.c */; };
|
||||||
2291A5B2175CAB2F001D4920 /* fmtdytst.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAC7156BE48D00753214 /* fmtdytst.c */; };
|
2291A5B2175CAB2F001D4920 /* fmtdytst.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAC7156BE48D00753214 /* fmtdytst.c */; };
|
||||||
2291A5B3175CAB2F001D4920 /* fmthe.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAE4156BE6D500753214 /* fmthe.c */; };
|
2291A5B3175CAB2F001D4920 /* fmthe.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAE4156BE6D500753214 /* fmthe.c */; };
|
||||||
|
|
@ -113,6 +118,10 @@
|
||||||
22C2ACA718BE400A006B3677 /* testlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 31EEAC9E156AB73400714D05 /* testlib.c */; };
|
22C2ACA718BE400A006B3677 /* testlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 31EEAC9E156AB73400714D05 /* testlib.c */; };
|
||||||
22C2ACA918BE400A006B3677 /* libmps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31EEABFB156AAF9D00714D05 /* libmps.a */; };
|
22C2ACA918BE400A006B3677 /* libmps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31EEABFB156AAF9D00714D05 /* libmps.a */; };
|
||||||
22C2ACB018BE4049006B3677 /* nailboardtest.c in Sources */ = {isa = PBXBuildFile; fileRef = 22C2ACA018BE3FEC006B3677 /* nailboardtest.c */; };
|
22C2ACB018BE4049006B3677 /* nailboardtest.c in Sources */ = {isa = PBXBuildFile; fileRef = 22C2ACA018BE3FEC006B3677 /* nailboardtest.c */; };
|
||||||
|
22F846B518F437B900982BA7 /* testlib.c in Sources */ = {isa = PBXBuildFile; fileRef = 31EEAC9E156AB73400714D05 /* testlib.c */; };
|
||||||
|
22F846B718F437B900982BA7 /* libmps.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 31EEABFB156AAF9D00714D05 /* libmps.a */; };
|
||||||
|
22F846BE18F437D700982BA7 /* lockut.c in Sources */ = {isa = PBXBuildFile; fileRef = 22F846AF18F4379C00982BA7 /* lockut.c */; };
|
||||||
|
22F846BF18F437E000982BA7 /* testthrix.c in Sources */ = {isa = PBXBuildFile; fileRef = 22561A9718F4263300372C66 /* testthrix.c */; };
|
||||||
22FA176916E8D6FC0098B23F /* fmtdy.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAC6156BE48D00753214 /* fmtdy.c */; };
|
22FA176916E8D6FC0098B23F /* fmtdy.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAC6156BE48D00753214 /* fmtdy.c */; };
|
||||||
22FA176A16E8D6FC0098B23F /* fmtdytst.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAC7156BE48D00753214 /* fmtdytst.c */; };
|
22FA176A16E8D6FC0098B23F /* fmtdytst.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAC7156BE48D00753214 /* fmtdytst.c */; };
|
||||||
22FA176B16E8D6FC0098B23F /* fmthe.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAE4156BE6D500753214 /* fmthe.c */; };
|
22FA176B16E8D6FC0098B23F /* fmthe.c in Sources */ = {isa = PBXBuildFile; fileRef = 3124CAE4156BE6D500753214 /* fmthe.c */; };
|
||||||
|
|
@ -327,6 +336,13 @@
|
||||||
remoteGlobalIDString = 2D604B9B16514B1A003AAF46;
|
remoteGlobalIDString = 2D604B9B16514B1A003AAF46;
|
||||||
remoteInfo = mpseventtxt;
|
remoteInfo = mpseventtxt;
|
||||||
};
|
};
|
||||||
|
2286E4C818F4389E004111E2 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 22F846B018F437B900982BA7;
|
||||||
|
remoteInfo = lockut;
|
||||||
|
};
|
||||||
2291A5AE175CAB2F001D4920 /* PBXContainerItemProxy */ = {
|
2291A5AE175CAB2F001D4920 /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
|
containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
|
||||||
|
|
@ -418,6 +434,13 @@
|
||||||
remoteGlobalIDString = 3104AFF1156D37A0000A585A;
|
remoteGlobalIDString = 3104AFF1156D37A0000A585A;
|
||||||
remoteInfo = all;
|
remoteInfo = all;
|
||||||
};
|
};
|
||||||
|
22F846B218F437B900982BA7 /* PBXContainerItemProxy */ = {
|
||||||
|
isa = PBXContainerItemProxy;
|
||||||
|
containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
|
||||||
|
proxyType = 1;
|
||||||
|
remoteGlobalIDString = 31EEABFA156AAF9D00714D05;
|
||||||
|
remoteInfo = mps;
|
||||||
|
};
|
||||||
22FA176616E8D6FC0098B23F /* PBXContainerItemProxy */ = {
|
22FA176616E8D6FC0098B23F /* PBXContainerItemProxy */ = {
|
||||||
isa = PBXContainerItemProxy;
|
isa = PBXContainerItemProxy;
|
||||||
containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
|
containerPortal = 31EEABDA156AAE9E00714D05 /* Project object */;
|
||||||
|
|
@ -955,6 +978,15 @@
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 1;
|
runOnlyForDeploymentPostprocessing = 1;
|
||||||
};
|
};
|
||||||
|
22F846B818F437B900982BA7 /* CopyFiles */ = {
|
||||||
|
isa = PBXCopyFilesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
dstPath = /usr/share/man/man1/;
|
||||||
|
dstSubfolderSpec = 0;
|
||||||
|
files = (
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 1;
|
||||||
|
};
|
||||||
22FA177016E8D6FC0098B23F /* CopyFiles */ = {
|
22FA177016E8D6FC0098B23F /* CopyFiles */ = {
|
||||||
isa = PBXCopyFilesBuildPhase;
|
isa = PBXCopyFilesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
|
|
@ -1297,6 +1329,8 @@
|
||||||
2231BB6918CA983C002D6322 /* locusss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = locusss.c; sourceTree = "<group>"; };
|
2231BB6918CA983C002D6322 /* locusss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = locusss.c; sourceTree = "<group>"; };
|
||||||
224CC799175E1821002FF81B /* fotest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fotest; sourceTree = BUILT_PRODUCTS_DIR; };
|
224CC799175E1821002FF81B /* fotest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = fotest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
224CC79E175E3202002FF81B /* fotest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fotest.c; sourceTree = "<group>"; };
|
224CC79E175E3202002FF81B /* fotest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fotest.c; sourceTree = "<group>"; };
|
||||||
|
22561A9618F4263300372C66 /* testthr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = testthr.h; sourceTree = "<group>"; };
|
||||||
|
22561A9718F4263300372C66 /* testthrix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = testthrix.c; sourceTree = "<group>"; };
|
||||||
2291A5A8175CAA51001D4920 /* poolmv2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = poolmv2.h; sourceTree = "<group>"; };
|
2291A5A8175CAA51001D4920 /* poolmv2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = poolmv2.h; sourceTree = "<group>"; };
|
||||||
2291A5A9175CAA9B001D4920 /* awlutth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = awlutth.c; sourceTree = "<group>"; };
|
2291A5A9175CAA9B001D4920 /* awlutth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = awlutth.c; sourceTree = "<group>"; };
|
||||||
2291A5AA175CAA9B001D4920 /* exposet0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = exposet0.c; sourceTree = "<group>"; };
|
2291A5AA175CAA9B001D4920 /* exposet0.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = exposet0.c; sourceTree = "<group>"; };
|
||||||
|
|
@ -1317,6 +1351,8 @@
|
||||||
22C2ACAF18BE400A006B3677 /* nailboardtest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = nailboardtest; sourceTree = BUILT_PRODUCTS_DIR; };
|
22C2ACAF18BE400A006B3677 /* nailboardtest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = nailboardtest; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
22E30E821886FF1400D98EA9 /* nailboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nailboard.c; sourceTree = "<group>"; };
|
22E30E821886FF1400D98EA9 /* nailboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nailboard.c; sourceTree = "<group>"; };
|
||||||
22E30E831886FF1400D98EA9 /* nailboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nailboard.h; sourceTree = "<group>"; };
|
22E30E831886FF1400D98EA9 /* nailboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nailboard.h; sourceTree = "<group>"; };
|
||||||
|
22F846AF18F4379C00982BA7 /* lockut.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lockut.c; sourceTree = "<group>"; };
|
||||||
|
22F846BD18F437B900982BA7 /* lockut */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = lockut; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
22FA177516E8D6FC0098B23F /* amcssth */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = amcssth; sourceTree = BUILT_PRODUCTS_DIR; };
|
22FA177516E8D6FC0098B23F /* amcssth */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = amcssth; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
22FA177616E8D7A80098B23F /* amcssth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = amcssth.c; sourceTree = "<group>"; };
|
22FA177616E8D7A80098B23F /* amcssth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = amcssth.c; sourceTree = "<group>"; };
|
||||||
22FACED1188807FF000FDBC1 /* airtest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = airtest.c; sourceTree = "<group>"; };
|
22FACED1188807FF000FDBC1 /* airtest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = airtest.c; sourceTree = "<group>"; };
|
||||||
|
|
@ -1326,8 +1362,6 @@
|
||||||
22FACED5188807FF000FDBC1 /* fmtno.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fmtno.h; sourceTree = "<group>"; };
|
22FACED5188807FF000FDBC1 /* fmtno.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fmtno.h; sourceTree = "<group>"; };
|
||||||
22FACED6188807FF000FDBC1 /* fmtscheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fmtscheme.c; sourceTree = "<group>"; };
|
22FACED6188807FF000FDBC1 /* fmtscheme.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = fmtscheme.c; sourceTree = "<group>"; };
|
||||||
22FACED7188807FF000FDBC1 /* fmtscheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fmtscheme.h; sourceTree = "<group>"; };
|
22FACED7188807FF000FDBC1 /* fmtscheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fmtscheme.h; sourceTree = "<group>"; };
|
||||||
22FACED8188807FF000FDBC1 /* locbwcss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = locbwcss.c; sourceTree = "<group>"; };
|
|
||||||
22FACED9188807FF000FDBC1 /* locusss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = locusss.c; sourceTree = "<group>"; };
|
|
||||||
22FACEDA1888088A000FDBC1 /* ss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ss.c; sourceTree = "<group>"; };
|
22FACEDA1888088A000FDBC1 /* ss.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ss.c; sourceTree = "<group>"; };
|
||||||
22FACEDB188808D5000FDBC1 /* mpscmfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpscmfs.h; sourceTree = "<group>"; };
|
22FACEDB188808D5000FDBC1 /* mpscmfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpscmfs.h; sourceTree = "<group>"; };
|
||||||
22FACEDC18880933000FDBC1 /* poolmfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = poolmfs.h; sourceTree = "<group>"; };
|
22FACEDC18880933000FDBC1 /* poolmfs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = poolmfs.h; sourceTree = "<group>"; };
|
||||||
|
|
@ -1665,6 +1699,14 @@
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
22F846B618F437B900982BA7 /* Frameworks */ = {
|
||||||
|
isa = PBXFrameworksBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
22F846B718F437B900982BA7 /* libmps.a in Frameworks */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
22FA176E16E8D6FC0098B23F /* Frameworks */ = {
|
22FA176E16E8D6FC0098B23F /* Frameworks */ = {
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
|
|
@ -2080,6 +2122,7 @@
|
||||||
3124CAB3156BE1B700753214 /* Tests */ = {
|
3124CAB3156BE1B700753214 /* Tests */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
22F846AF18F4379C00982BA7 /* lockut.c */,
|
||||||
3114A63D156E94EA001E0AA3 /* abqtest.c */,
|
3114A63D156E94EA001E0AA3 /* abqtest.c */,
|
||||||
22FACED1188807FF000FDBC1 /* airtest.c */,
|
22FACED1188807FF000FDBC1 /* airtest.c */,
|
||||||
3124CAF5156BE81100753214 /* amcss.c */,
|
3124CAF5156BE81100753214 /* amcss.c */,
|
||||||
|
|
@ -2127,6 +2170,8 @@
|
||||||
3114A628156E949A001E0AA3 /* teletest.c */,
|
3114A628156E949A001E0AA3 /* teletest.c */,
|
||||||
31EEAC9E156AB73400714D05 /* testlib.c */,
|
31EEAC9E156AB73400714D05 /* testlib.c */,
|
||||||
2291A5F0175CB7A4001D4920 /* testlib.h */,
|
2291A5F0175CB7A4001D4920 /* testlib.h */,
|
||||||
|
22561A9618F4263300372C66 /* testthr.h */,
|
||||||
|
22561A9718F4263300372C66 /* testthrix.c */,
|
||||||
3114A6BA156E9768001E0AA3 /* walkt0.c */,
|
3114A6BA156E9768001E0AA3 /* walkt0.c */,
|
||||||
31D6005E156D3F4A00337B26 /* zcoll.c */,
|
31D6005E156D3F4A00337B26 /* zcoll.c */,
|
||||||
31D6007B156D3FCC00337B26 /* zmess.c */,
|
31D6007B156D3FCC00337B26 /* zmess.c */,
|
||||||
|
|
@ -2220,6 +2265,7 @@
|
||||||
2231BB6718CA97DC002D6322 /* locusss */,
|
2231BB6718CA97DC002D6322 /* locusss */,
|
||||||
22FACEED18880983000FDBC1 /* airtest */,
|
22FACEED18880983000FDBC1 /* airtest */,
|
||||||
22C2ACAF18BE400A006B3677 /* nailboardtest */,
|
22C2ACAF18BE400A006B3677 /* nailboardtest */,
|
||||||
|
22F846BD18F437B900982BA7 /* lockut */,
|
||||||
);
|
);
|
||||||
name = Products;
|
name = Products;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
|
|
@ -2548,6 +2594,24 @@
|
||||||
productReference = 22C2ACAF18BE400A006B3677 /* nailboardtest */;
|
productReference = 22C2ACAF18BE400A006B3677 /* nailboardtest */;
|
||||||
productType = "com.apple.product-type.tool";
|
productType = "com.apple.product-type.tool";
|
||||||
};
|
};
|
||||||
|
22F846B018F437B900982BA7 /* lockut */ = {
|
||||||
|
isa = PBXNativeTarget;
|
||||||
|
buildConfigurationList = 22F846B918F437B900982BA7 /* Build configuration list for PBXNativeTarget "lockut" */;
|
||||||
|
buildPhases = (
|
||||||
|
22F846B318F437B900982BA7 /* Sources */,
|
||||||
|
22F846B618F437B900982BA7 /* Frameworks */,
|
||||||
|
22F846B818F437B900982BA7 /* CopyFiles */,
|
||||||
|
);
|
||||||
|
buildRules = (
|
||||||
|
);
|
||||||
|
dependencies = (
|
||||||
|
22F846B118F437B900982BA7 /* PBXTargetDependency */,
|
||||||
|
);
|
||||||
|
name = lockut;
|
||||||
|
productName = lockcov;
|
||||||
|
productReference = 22F846BD18F437B900982BA7 /* lockut */;
|
||||||
|
productType = "com.apple.product-type.tool";
|
||||||
|
};
|
||||||
22FA176416E8D6FC0098B23F /* amcssth */ = {
|
22FA176416E8D6FC0098B23F /* amcssth */ = {
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 22FA177116E8D6FC0098B23F /* Build configuration list for PBXNativeTarget "amcssth" */;
|
buildConfigurationList = 22FA177116E8D6FC0098B23F /* Build configuration list for PBXNativeTarget "amcssth" */;
|
||||||
|
|
@ -3274,6 +3338,7 @@
|
||||||
2231BB4C18CA97D8002D6322 /* locbwcss */,
|
2231BB4C18CA97D8002D6322 /* locbwcss */,
|
||||||
31D60026156D3D3E00337B26 /* lockcov */,
|
31D60026156D3D3E00337B26 /* lockcov */,
|
||||||
2231BB5A18CA97DC002D6322 /* locusss */,
|
2231BB5A18CA97DC002D6322 /* locusss */,
|
||||||
|
22F846B018F437B900982BA7 /* lockut */,
|
||||||
3114A58F156E913C001E0AA3 /* locv */,
|
3114A58F156E913C001E0AA3 /* locv */,
|
||||||
3114A694156E971B001E0AA3 /* messtest */,
|
3114A694156E971B001E0AA3 /* messtest */,
|
||||||
31EEAC64156AB52600714D05 /* mpmss */,
|
31EEAC64156AB52600714D05 /* mpmss */,
|
||||||
|
|
@ -3353,6 +3418,7 @@
|
||||||
2291A5B3175CAB2F001D4920 /* fmthe.c in Sources */,
|
2291A5B3175CAB2F001D4920 /* fmthe.c in Sources */,
|
||||||
2291A5B4175CAB2F001D4920 /* fmtno.c in Sources */,
|
2291A5B4175CAB2F001D4920 /* fmtno.c in Sources */,
|
||||||
2291A5B5175CAB2F001D4920 /* testlib.c in Sources */,
|
2291A5B5175CAB2F001D4920 /* testlib.c in Sources */,
|
||||||
|
22561A9918F4266600372C66 /* testthrix.c in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
@ -3398,6 +3464,16 @@
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
22F846B318F437B900982BA7 /* Sources */ = {
|
||||||
|
isa = PBXSourcesBuildPhase;
|
||||||
|
buildActionMask = 2147483647;
|
||||||
|
files = (
|
||||||
|
22F846BE18F437D700982BA7 /* lockut.c in Sources */,
|
||||||
|
22F846B518F437B900982BA7 /* testlib.c in Sources */,
|
||||||
|
22F846BF18F437E000982BA7 /* testthrix.c in Sources */,
|
||||||
|
);
|
||||||
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
|
};
|
||||||
22FA176716E8D6FC0098B23F /* Sources */ = {
|
22FA176716E8D6FC0098B23F /* Sources */ = {
|
||||||
isa = PBXSourcesBuildPhase;
|
isa = PBXSourcesBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
|
|
@ -3408,6 +3484,7 @@
|
||||||
22FA176B16E8D6FC0098B23F /* fmthe.c in Sources */,
|
22FA176B16E8D6FC0098B23F /* fmthe.c in Sources */,
|
||||||
22FA176C16E8D6FC0098B23F /* fmtno.c in Sources */,
|
22FA176C16E8D6FC0098B23F /* fmtno.c in Sources */,
|
||||||
22FA176D16E8D6FC0098B23F /* testlib.c in Sources */,
|
22FA176D16E8D6FC0098B23F /* testlib.c in Sources */,
|
||||||
|
22561A9818F4265D00372C66 /* testthrix.c in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
@ -3684,6 +3761,7 @@
|
||||||
318DA8D31892B27E0089718C /* testlib.c in Sources */,
|
318DA8D31892B27E0089718C /* testlib.c in Sources */,
|
||||||
6313D47318A4028E00EB03EF /* djbench.c in Sources */,
|
6313D47318A4028E00EB03EF /* djbench.c in Sources */,
|
||||||
318DA8D21892B13B0089718C /* getoptl.c in Sources */,
|
318DA8D21892B13B0089718C /* getoptl.c in Sources */,
|
||||||
|
22561A9A18F426BB00372C66 /* testthrix.c in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
@ -3791,6 +3869,7 @@
|
||||||
6313D47518A40C6300EB03EF /* fmtdytst.c in Sources */,
|
6313D47518A40C6300EB03EF /* fmtdytst.c in Sources */,
|
||||||
6313D47618A40C7B00EB03EF /* fmtdy.c in Sources */,
|
6313D47618A40C7B00EB03EF /* fmtdy.c in Sources */,
|
||||||
6313D46A18A400B200EB03EF /* getoptl.c in Sources */,
|
6313D46A18A400B200EB03EF /* getoptl.c in Sources */,
|
||||||
|
22561A9B18F426F300372C66 /* testthrix.c in Sources */,
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
|
|
@ -3832,6 +3911,11 @@
|
||||||
target = 2D604B9B16514B1A003AAF46 /* mpseventtxt */;
|
target = 2D604B9B16514B1A003AAF46 /* mpseventtxt */;
|
||||||
targetProxy = 2275798816C5422900B662B0 /* PBXContainerItemProxy */;
|
targetProxy = 2275798816C5422900B662B0 /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
|
2286E4C918F4389E004111E2 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 22F846B018F437B900982BA7 /* lockut */;
|
||||||
|
targetProxy = 2286E4C818F4389E004111E2 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
2291A5AD175CAB2F001D4920 /* PBXTargetDependency */ = {
|
2291A5AD175CAB2F001D4920 /* PBXTargetDependency */ = {
|
||||||
isa = PBXTargetDependency;
|
isa = PBXTargetDependency;
|
||||||
target = 31EEABFA156AAF9D00714D05 /* mps */;
|
target = 31EEABFA156AAF9D00714D05 /* mps */;
|
||||||
|
|
@ -3897,6 +3981,11 @@
|
||||||
target = 3104AFF1156D37A0000A585A /* all */;
|
target = 3104AFF1156D37A0000A585A /* all */;
|
||||||
targetProxy = 22CDE92D16E9EB9300366D0A /* PBXContainerItemProxy */;
|
targetProxy = 22CDE92D16E9EB9300366D0A /* PBXContainerItemProxy */;
|
||||||
};
|
};
|
||||||
|
22F846B118F437B900982BA7 /* PBXTargetDependency */ = {
|
||||||
|
isa = PBXTargetDependency;
|
||||||
|
target = 31EEABFA156AAF9D00714D05 /* mps */;
|
||||||
|
targetProxy = 22F846B218F437B900982BA7 /* PBXContainerItemProxy */;
|
||||||
|
};
|
||||||
22FA176516E8D6FC0098B23F /* PBXTargetDependency */ = {
|
22FA176516E8D6FC0098B23F /* PBXTargetDependency */ = {
|
||||||
isa = PBXTargetDependency;
|
isa = PBXTargetDependency;
|
||||||
target = 31EEABFA156AAF9D00714D05 /* mps */;
|
target = 31EEABFA156AAF9D00714D05 /* mps */;
|
||||||
|
|
@ -4400,6 +4489,27 @@
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
22F846BA18F437B900982BA7 /* Debug */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
PRODUCT_NAME = lockut;
|
||||||
|
};
|
||||||
|
name = Debug;
|
||||||
|
};
|
||||||
|
22F846BB18F437B900982BA7 /* Release */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
PRODUCT_NAME = lockut;
|
||||||
|
};
|
||||||
|
name = Release;
|
||||||
|
};
|
||||||
|
22F846BC18F437B900982BA7 /* RASH */ = {
|
||||||
|
isa = XCBuildConfiguration;
|
||||||
|
buildSettings = {
|
||||||
|
PRODUCT_NAME = lockut;
|
||||||
|
};
|
||||||
|
name = RASH;
|
||||||
|
};
|
||||||
22FA177216E8D6FC0098B23F /* Debug */ = {
|
22FA177216E8D6FC0098B23F /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
|
@ -5537,6 +5647,16 @@
|
||||||
defaultConfigurationIsVisible = 0;
|
defaultConfigurationIsVisible = 0;
|
||||||
defaultConfigurationName = Release;
|
defaultConfigurationName = Release;
|
||||||
};
|
};
|
||||||
|
22F846B918F437B900982BA7 /* Build configuration list for PBXNativeTarget "lockut" */ = {
|
||||||
|
isa = XCConfigurationList;
|
||||||
|
buildConfigurations = (
|
||||||
|
22F846BA18F437B900982BA7 /* Debug */,
|
||||||
|
22F846BB18F437B900982BA7 /* Release */,
|
||||||
|
22F846BC18F437B900982BA7 /* RASH */,
|
||||||
|
);
|
||||||
|
defaultConfigurationIsVisible = 0;
|
||||||
|
defaultConfigurationName = Release;
|
||||||
|
};
|
||||||
22FA177116E8D6FC0098B23F /* Build configuration list for PBXNativeTarget "amcssth" */ = {
|
22FA177116E8D6FC0098B23F /* Build configuration list for PBXNativeTarget "amcssth" */ = {
|
||||||
isa = XCConfigurationList;
|
isa = XCConfigurationList;
|
||||||
buildConfigurations = (
|
buildConfigurations = (
|
||||||
|
|
|
||||||
123
mps/code/testthr.h
Normal file
123
mps/code/testthr.h
Normal file
|
|
@ -0,0 +1,123 @@
|
||||||
|
/* testthr.h: MULTI-THREADED TEST INTERFACE
|
||||||
|
*
|
||||||
|
* $Id: //info.ravenbrook.com/project/mps/master/code/testlib.h#30 $
|
||||||
|
* Copyright (c) 2014 Ravenbrook Limited. See end of file for license.
|
||||||
|
*
|
||||||
|
* .purpose: Simple interface to threads that makes it possible to
|
||||||
|
* write test cases that are portable between Windows (using the
|
||||||
|
* implementation in testthrw3.c) and Unix (using the implementation
|
||||||
|
* in testthrix.c).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef testthr_h
|
||||||
|
#define testthr_h
|
||||||
|
|
||||||
|
#include "mpstd.h"
|
||||||
|
|
||||||
|
|
||||||
|
/* testthr_routine_t -- type of thread routines
|
||||||
|
*
|
||||||
|
* Use the pthread type here and convert back and forth in the Windows
|
||||||
|
* implementation.
|
||||||
|
*/
|
||||||
|
typedef void *(*testthr_routine_t)(void *);
|
||||||
|
|
||||||
|
|
||||||
|
/* testthr_t -- type of thread identifiers
|
||||||
|
*
|
||||||
|
* It is necessary to define it here (even though it requires some
|
||||||
|
* #ifdefs) so that clients can allocate storage for them.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if defined(MPS_OS_W3)
|
||||||
|
|
||||||
|
#include "mpswin.h"
|
||||||
|
|
||||||
|
/* On Windows, a thread is identified by a HANDLE.
|
||||||
|
* <http://msdn.microsoft.com/en-us/library/windows/desktop/aa383751.aspx>
|
||||||
|
* But use a structure so that the thread has somewhere to store its
|
||||||
|
* result for use by testthr_join.
|
||||||
|
*/
|
||||||
|
typedef struct testthr_t {
|
||||||
|
HANDLE handle;
|
||||||
|
testthr_routine_t start;
|
||||||
|
void *arg; /* argument to pass to start */
|
||||||
|
void *result; /* result returned from start */
|
||||||
|
} testthr_t;
|
||||||
|
|
||||||
|
#elif defined(MPS_OS_FR) || defined(MPS_OS_LI) || defined(MPS_OS_XC)
|
||||||
|
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
|
/* In pthreads, a thread is identified by a pthread_t, which is
|
||||||
|
* allowed "to be defined as a structure" [IEEE Std 1003.1, sys/types.h]
|
||||||
|
* <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html>
|
||||||
|
*/
|
||||||
|
typedef pthread_t testthr_t;
|
||||||
|
|
||||||
|
#else
|
||||||
|
#error "Unknown platform: can't determine a type for testthr_t."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
/* testthr_create -- create a thread
|
||||||
|
*
|
||||||
|
* Store the identifier of the newly created thread in *thread_o, and
|
||||||
|
* call start, passing arg as the single parameter.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void testthr_create(testthr_t *thread_o, testthr_routine_t start, void *arg);
|
||||||
|
|
||||||
|
|
||||||
|
/* testthr_join -- wait for a thread to complete
|
||||||
|
*
|
||||||
|
* Suspend execution of the calling thread until the target thread
|
||||||
|
* terminates (if necessary), and if result_o is non-NULL, update
|
||||||
|
* *result_o with the return value of the thread's start.
|
||||||
|
*/
|
||||||
|
|
||||||
|
void testthr_join(testthr_t *thread, void **result_o);
|
||||||
|
|
||||||
|
#endif /* testthr_h */
|
||||||
|
|
||||||
|
|
||||||
|
/* C. COPYRIGHT AND LICENSE
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||||
|
* All rights reserved. This is an open source license. Contact
|
||||||
|
* Ravenbrook for commercial licensing options.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Redistributions in any form must be accompanied by information on how
|
||||||
|
* to obtain complete source code for this software and any accompanying
|
||||||
|
* software that uses this software. The source code must either be
|
||||||
|
* included in the distribution or be available for no more than the cost
|
||||||
|
* of distribution plus a nominal fee, and must be freely redistributable
|
||||||
|
* under reasonable conditions. For an executable file, complete source
|
||||||
|
* code means the source code for all modules it contains. It does not
|
||||||
|
* include source code for modules or files that typically accompany the
|
||||||
|
* major components of the operating system on which the executable file
|
||||||
|
* runs.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
|
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||||
|
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
66
mps/code/testthrix.c
Normal file
66
mps/code/testthrix.c
Normal file
|
|
@ -0,0 +1,66 @@
|
||||||
|
/* testthrix.c: MULTI-THREADED TEST IMPLEMENTATION (POSIX THREADS)
|
||||||
|
*
|
||||||
|
* $Id: //info.ravenbrook.com/project/mps/master/code/testlib.h#30 $
|
||||||
|
* Copyright (c) 2014 Ravenbrook Limited. See end of file for license.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "testlib.h"
|
||||||
|
#include "testthr.h"
|
||||||
|
|
||||||
|
#include <string.h> /* strerror */
|
||||||
|
|
||||||
|
void testthr_create(testthr_t *thread_o, testthr_routine_t start, void *arg)
|
||||||
|
{
|
||||||
|
int res = pthread_create(thread_o, NULL, start, arg);
|
||||||
|
if (res != 0)
|
||||||
|
error("pthread_create failed with result %d (%s)", res, strerror(res));
|
||||||
|
}
|
||||||
|
|
||||||
|
void testthr_join(testthr_t *thread, void **result_o)
|
||||||
|
{
|
||||||
|
int res = pthread_join(*thread, result_o);
|
||||||
|
if (res != 0)
|
||||||
|
error("pthread_join failed with result %d (%s)", res, strerror(res));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* C. COPYRIGHT AND LICENSE
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||||
|
* All rights reserved. This is an open source license. Contact
|
||||||
|
* Ravenbrook for commercial licensing options.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Redistributions in any form must be accompanied by information on how
|
||||||
|
* to obtain complete source code for this software and any accompanying
|
||||||
|
* software that uses this software. The source code must either be
|
||||||
|
* included in the distribution or be available for no more than the cost
|
||||||
|
* of distribution plus a nominal fee, and must be freely redistributable
|
||||||
|
* under reasonable conditions. For an executable file, complete source
|
||||||
|
* code means the source code for all modules it contains. It does not
|
||||||
|
* include source code for modules or files that typically accompany the
|
||||||
|
* major components of the operating system on which the executable file
|
||||||
|
* runs.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
|
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||||
|
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
80
mps/code/testthrw3.c
Normal file
80
mps/code/testthrw3.c
Normal file
|
|
@ -0,0 +1,80 @@
|
||||||
|
/* testthrw3.c: MULTI-THREADED TEST IMPLEMENTATION (WINDOWS)
|
||||||
|
*
|
||||||
|
* $Id: //info.ravenbrook.com/project/mps/master/code/testlib.h#30 $
|
||||||
|
* Copyright (c) 2014 Ravenbrook Limited. See end of file for license.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "testlib.h"
|
||||||
|
#include "testthr.h"
|
||||||
|
|
||||||
|
static DWORD WINAPI testthr_start(LPVOID arg)
|
||||||
|
{
|
||||||
|
testthr_t *thread = arg;
|
||||||
|
thread->result = (*thread->start)(thread->arg);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void testthr_create(testthr_t *thread_o, testthr_routine_t start, void *arg)
|
||||||
|
{
|
||||||
|
HANDLE res;
|
||||||
|
thread_o->start = start;
|
||||||
|
thread_o->arg = arg;
|
||||||
|
res = CreateThread(NULL, 0, testthr_start, thread_o, 0, NULL);
|
||||||
|
if (res == NULL)
|
||||||
|
error("CreateThread failed with error %lu",
|
||||||
|
(unsigned long)GetLastError());
|
||||||
|
else
|
||||||
|
thread_o->handle = res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void testthr_join(testthr_t *thread, void **result_o)
|
||||||
|
{
|
||||||
|
DWORD res = WaitForSingleObject(thread->handle, INFINITE);
|
||||||
|
if (res != WAIT_OBJECT_0)
|
||||||
|
error("WaitForSingleObject failed with result %lu (error %lu)",
|
||||||
|
(unsigned long)res, (unsigned long)GetLastError());
|
||||||
|
if (result_o)
|
||||||
|
*result_o = thread->result;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* C. COPYRIGHT AND LICENSE
|
||||||
|
*
|
||||||
|
* Copyright (C) 2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
|
||||||
|
* All rights reserved. This is an open source license. Contact
|
||||||
|
* Ravenbrook for commercial licensing options.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are
|
||||||
|
* met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer.
|
||||||
|
*
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
|
* documentation and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* 3. Redistributions in any form must be accompanied by information on how
|
||||||
|
* to obtain complete source code for this software and any accompanying
|
||||||
|
* software that uses this software. The source code must either be
|
||||||
|
* included in the distribution or be available for no more than the cost
|
||||||
|
* of distribution plus a nominal fee, and must be freely redistributable
|
||||||
|
* under reasonable conditions. For an executable file, complete source
|
||||||
|
* code means the source code for all modules it contains. It does not
|
||||||
|
* include source code for modules or files that typically accompany the
|
||||||
|
* major components of the operating system on which the executable file
|
||||||
|
* runs.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
|
||||||
|
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
||||||
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
|
||||||
|
* PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||||
|
* COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||||
|
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||||
|
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
|
||||||
|
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||||
|
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||||
|
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
|
@ -39,7 +39,7 @@ set ALL_TEST_CASES=^
|
||||||
fotest.exe ^
|
fotest.exe ^
|
||||||
locbwcss.exe ^
|
locbwcss.exe ^
|
||||||
lockcov.exe ^
|
lockcov.exe ^
|
||||||
lockutw3.exe ^
|
lockut.exe ^
|
||||||
locusss.exe ^
|
locusss.exe ^
|
||||||
locv.exe ^
|
locv.exe ^
|
||||||
messtest.exe ^
|
messtest.exe ^
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,7 @@ ALL_TEST_CASES="
|
||||||
fotest
|
fotest
|
||||||
locbwcss
|
locbwcss
|
||||||
lockcov
|
lockcov
|
||||||
|
lockut
|
||||||
locusss
|
locusss
|
||||||
locv
|
locv
|
||||||
messtest
|
messtest
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue