mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
Add support for NetBSD
Originally from David Holland <dholland@NetBSD.org>.
This commit is contained in:
parent
5651d00751
commit
5f7bd993de
4 changed files with 33 additions and 10 deletions
|
@ -33,8 +33,8 @@ Revision History:
|
|||
#include<sys/time.h>
|
||||
#include<sys/errno.h>
|
||||
#include<pthread.h>
|
||||
#elif defined(_LINUX_) || defined(_FREEBSD_)
|
||||
// Linux
|
||||
#elif defined(_LINUX_) || defined(_FREEBSD_) || defined(_NetBSD_)
|
||||
// Linux & FreeBSD & NetBSD
|
||||
#include<errno.h>
|
||||
#include<pthread.h>
|
||||
#include<sched.h>
|
||||
|
@ -66,8 +66,8 @@ struct scoped_timer::imp {
|
|||
pthread_mutex_t m_mutex;
|
||||
pthread_cond_t m_condition_var;
|
||||
struct timespec m_end_time;
|
||||
#elif defined(_LINUX_) || defined(_FREEBSD_)
|
||||
// Linux & FreeBSD
|
||||
#elif defined(_LINUX_) || defined(_FREEBSD_) || defined(_NETBSD_)
|
||||
// Linux & FreeBSD & NetBSD
|
||||
pthread_t m_thread_id;
|
||||
pthread_mutex_t m_mutex;
|
||||
pthread_cond_t m_cond;
|
||||
|
@ -104,7 +104,7 @@ struct scoped_timer::imp {
|
|||
|
||||
return st;
|
||||
}
|
||||
#elif defined(_LINUX_) || defined(_FREEBSD_)
|
||||
#elif defined(_LINUX_) || defined(_FREEBSD_) || defined(_NETBSD_)
|
||||
static void* thread_func(void *arg) {
|
||||
scoped_timer::imp *st = static_cast<scoped_timer::imp*>(arg);
|
||||
|
||||
|
@ -175,8 +175,8 @@ struct scoped_timer::imp {
|
|||
|
||||
if (pthread_create(&m_thread_id, &m_attributes, &thread_func, this) != 0)
|
||||
throw default_exception("failed to start timer thread");
|
||||
#elif defined(_LINUX_) || defined(_FREEBSD_)
|
||||
// Linux & FreeBSD
|
||||
#elif defined(_LINUX_) || defined(_FREEBSD_) || defined(_NETBSD_)
|
||||
// Linux & FreeBSD & NetBSD
|
||||
m_ms = ms;
|
||||
m_initialized = false;
|
||||
m_signal_sent = false;
|
||||
|
@ -216,8 +216,8 @@ struct scoped_timer::imp {
|
|||
throw default_exception("failed to destroy pthread condition variable");
|
||||
if (pthread_attr_destroy(&m_attributes) != 0)
|
||||
throw default_exception("failed to destroy pthread attributes object");
|
||||
#elif defined(_LINUX_) || defined(_FREEBSD_)
|
||||
// Linux & FreeBSD
|
||||
#elif defined(_LINUX_) || defined(_FREEBSD_) || defined(_NETBSD_)
|
||||
// Linux & FreeBSD & NetBSD
|
||||
bool init = false;
|
||||
|
||||
// spin until timer thread has been created
|
||||
|
|
|
@ -134,6 +134,11 @@ public:
|
|||
|
||||
#include<ctime>
|
||||
|
||||
#ifndef CLOCK_PROCESS_CPUTIME_ID
|
||||
/* BSD */
|
||||
# define CLOCK_PROCESS_CPUTIME_ID CLOCK_MONOTONIC
|
||||
#endif
|
||||
|
||||
class stopwatch {
|
||||
unsigned long long m_time; // elapsed time in ns
|
||||
bool m_running;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue