bug-commoncpp
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Solaris 8 and pthread issues.


From: Anand Narwani
Subject: Solaris 8 and pthread issues.
Date: Fri, 25 Oct 2002 12:41:01 -0700 (PDT)

Hello Folks,
I am attempting to write a simple program using Common
C++2 1.0.3 on Solaris 8.  Here is the code:

/**** Code Starts Here ****/
#include <cc++/thread.h>
#include <cstdio>
#include <cstring>
#include <iostream>

#ifdef  CCXX_NAMESPACES
using namespace std;
using namespace ost;
#endif

class Foo: public Thread {
    public:
        Foo(Event *e){myevent = e;};
        void run();
    private:
        Event *myevent;
};

void Foo::run() {
    while (1) {
        for (int i=0; i< 5; i++) {
            cout << "counting... i=" << i << endl;
            sleep(500);
            yield();
        }
        myevent->signal();
        sleep(1000);
    }
}

int main (int argc,char** argv) {

    Event *ev;
    Foo *f;

    ev = new Event();
    f = new Foo(ev);
    f->start();
    ev->wait();
    cout << "**** Caught Event ****" << endl;

}
/***** Code Ends Here ****/

I've attempted to run this with GCC 2.95.2 and also
GCC 3.2 both seem to have the same results: 
Event::wait() never returns when I do a
Event::signal().  If I test with Event::wait(timeout),
it never times out.  
I've looked at the source for the Event Class and I
can see the call to pthread_cond_wait() or
pthread_cond_waittimeout().  When these are called,
neither one returns.  I've searched and searched the
newsgroups and the web.  The only issue I've found is
that Solaris *might* have a problem with recursive
mutexes.  Has anyone experienced problems like this? 
Am I missing something silly?

Thanks in advance,
Anand

__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]