Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
30 lines (20 sloc) 375 Bytes
#ifndef com_sleepless_sys_seq_cpp
#define com_sleepless_sys_seq_cpp
/* Copyright 2010 Sleepless Software Inc. All Rights Reserved */
#include "mutex.cpp"
struct Seq
{
Mutex mutex;
int _seq;
Seq() { _seq = 0; }
Seq(int s) { _seq = s; }
int next()
{
int s;
mutex.lock();
s = _seq++;
mutex.unlock();
return s;
}
};
#endif // com_sleepless_sys_seq_cpp