Browse Source

Cleanup

git-svn-id: http://subversion.jackaudio.org/jack/jack2/trunk/jackmp@1240 0c269be4-1314-0410-8aa9-9f06e86f4224
tags/0.59
sletz 17 years ago
parent
commit
cd306431b9
2 changed files with 12 additions and 14 deletions
  1. +2
    -4
      tests/testSem.cpp
  2. +10
    -10
      tests/testThread.cpp

+ 2
- 4
tests/testSem.cpp View File

@@ -61,8 +61,7 @@ struct ServerThread : public JackRunnableInterface {
bool Execute()
{
printf("Execute Server\n");
for (int i = 0; i < ITER; i++)
{
for (int i = 0; i < ITER; i++) {
fClientSem->Signal();
fServerSem->Wait();
}
@@ -100,8 +99,7 @@ struct ClientThread : public JackRunnableInterface {
fClientSem->Wait();
gettimeofday(&T0, 0);
for (int i = 0; i < ITER; i++)
{
for (int i = 0; i < ITER; i++) {
fServerSem->Signal();
fClientSem->Wait();
}


+ 10
- 10
tests/testThread.cpp View File

@@ -38,29 +38,29 @@ void* ThreadHandler(void* arg)
char c;
printf("ThreadHandler\n");
try {
while (1) {
read(fFifo, &c, sizeof(c));
sleep (1);
//pthread_testcancel();
}
}catch (std::exception e) {}
while (1) {
read(fFifo, &c, sizeof(c));
sleep(1);
//pthread_testcancel();
}
} catch (std::exception e) {}
}


int main (int argc, char * const argv[])
int main(int argc, char * const argv[])
{
int res;
void* status;
struct stat statbuf;
printf("Thread test\n");
std::set_terminate (__gnu_cxx::__verbose_terminate_handler);
std::set_terminate(__gnu_cxx::__verbose_terminate_handler);

sprintf(fName, "/tmp/fifo");

if (stat(fName, &statbuf)) {
if (errno == ENOENT) {
if (mkfifo(fName, 0666) < 0){
if (mkfifo(fName, 0666) < 0) {
printf("Cannot create inter-client FIFO [%s]\n", fName);
return 0;
}
@@ -85,7 +85,7 @@ int main (int argc, char * const argv[])
return 0;
}
sleep (3);
sleep(3);
printf("Cancel Thread\n");
pthread_cancel(fThread);
pthread_join(fThread, &status);


Loading…
Cancel
Save