Skip to Content.
Sympa Menu

shibboleth-dev - Draft threads API

Subject: Shibboleth Developers

List archive

Draft threads API


Chronological Thread 
  • From: Derek Atkins <>
  • To:
  • Subject: Draft threads API
  • Date: 27 Jan 2003 15:28:40 -0500

Scott (et al),

Here is my proposed thread API. I'm not sure how to cope with the
various attribute calls, and honestly I don't like having all the
static "create()" routines..

Suggestions, comments?

-derek


/*
* shib-threads.h -- abstraction around Pthreads interface
*
* Created by: Derek Atkins
<>
*
* $Id: $
*/

#ifndef SHIB_THREADS_H
#define SHIB_THREADS_H

#ifdef __cplusplus
extern "C" {
#endif

#ifdef HAVE_PTHREAD_H
#include <pthread.h>
#endif

#ifdef __cplusplus
}


namespace shibtarget {

class Thread {
public:
static Thread* create(void* (*start_routine)(void*), void* arg);
static void exit(void* return);

virtual int detach() = 0;
virtual int join(void** thread_return) = 0;
};

class Mutex {
public:
static Mutex* create();

virtual int lock() = 0;
virtual int unlock() = 0;
};

class CondWait {
public:
static CondWait* create();

virtual int wait(Mutex*) = 0;
virtual int timedwait(Mutex*, struct timespec *abstime) = 0;
virutal int signal() = 0;
virtual int broadcast() = 0;
};

class RWLock {
public:
static RWLock* create();

virtual int rdlock() = 0;
virtual int wrlock() = 0;
virtual int unlock() = 0;
};

} // namespace

#endif /* __cplusplus */
#endif /* SHIB_THREADS_H */

--
Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
Member, MIT Student Information Processing Board (SIPB)
URL: http://web.mit.edu/warlord/ PP-ASEL-IA N1NWH


PGP key available

------------------------------------------------------mace-shib-design-+
For list utilities, archives, subscribe, unsubscribe, etc. please visit the
ListProc web interface at

http://archives.internet2.edu/

------------------------------------------------------mace-shib-design--



  • Draft threads API, Derek Atkins, 01/27/2003

Archive powered by MHonArc 2.6.16.

Top of Page