Exemple #1
0
/* This function prints a hex dump of (len) bytes at address (p) */
void
w_debug::memdump(void *p, int len)
{
    register int i;
    char *c = (char *)p;
    
    clog << "x";
    for(i=0; i< len; i++) {
        W_FORM2(clog,("%2.2x", (*(c+i))&0xff));
        if(i%32 == 31) {
            clog << std::endl << "x";
        } else if(i%4 == 3) {
            clog <<  " x";
        }
    }
    clog << "--done" << std::endl;
}
Exemple #2
0
sthread_t::~sthread_t()
{
    /*
    fprintf(stderr, "sthread_t %s destructed, this %p core %p pthread %p\n",
            name(), this, _core, (void *)myself());
    fflush(stderr);
    */
    {
        CRITICAL_SECTION(cs, _wait_lock);
        /* Valid states for destroying a thread are ...
           1) It was never started
           2) It ended.
           3) There is some braindamage in that that blocked threads
           can be deleted.  This is sick and wrong, and it
           can cause race conditions.  It is enabled for compatibility,
           and hopefully the warning messages will tell you if
           something is wrong. */
        w_assert1(_status == t_virgin
                  || _status == t_defunct
                  || _status == t_blocked
                 );

        if (_link.member_of()) {
            W_FORM2(cerr,("sthread_t(%#lx): \"%s\": destroying a thread on a list!",
                          (long)this, name()));
        }
    }
    sthread_core_exit(_core, _terminated);

    delete _core;
    _core = 0;

    DO_PTHREAD(pthread_cond_destroy(_start_cond));
    delete _start_cond;
    _start_cond = 0;

    DO_PTHREAD(pthread_mutex_destroy(_start_terminate_lock));
    delete _start_terminate_lock;
    _start_terminate_lock = 0; // clean up for valgrind

}