Skip to content
Snippets Groups Projects
Commit 15e43081 authored by Arnon Kanfi's avatar Arnon Kanfi
Browse files

Merge branch 'master' of github.com:cloudius-systems/osv

parents 66bb1d27 2450ee3e
No related branches found
No related tags found
No related merge requests found
- make delay() do something useful
- sort out various timing functions in <sys/time.h> - sort out various timing functions in <sys/time.h>
...@@ -65,9 +65,11 @@ int synch_port::msleep(void *chan, struct mtx *mtx, ...@@ -65,9 +65,11 @@ int synch_port::msleep(void *chan, struct mtx *mtx,
wait_lock = &mtx->_mutex; wait_lock = &mtx->_mutex;
} }
mutex_lock(&_lock); if (chan) {
_evlist.insert(std::make_pair(chan, &wait)); mutex_lock(&_lock);
mutex_unlock(&_lock); _evlist.insert(std::make_pair(chan, &wait));
mutex_unlock(&_lock);
}
if (timo_hz) { if (timo_hz) {
u64 nanoseconds = timo_hz*(1000000000L/hz); u64 nanoseconds = timo_hz*(1000000000L/hz);
...@@ -147,6 +149,11 @@ extern "C" int tsleep(void *chan, int priority, const char *wmesg, int timo) ...@@ -147,6 +149,11 @@ extern "C" int tsleep(void *chan, int priority, const char *wmesg, int timo)
return (msleep(chan, 0, priority, wmesg, timo)); return (msleep(chan, 0, priority, wmesg, timo));
} }
extern "C" void bsd_pause(const char *wmesg, int timo)
{
msleep(0, 0, 0, wmesg, timo);
}
extern "C" void wakeup(void* chan) extern "C" void wakeup(void* chan)
{ {
synch_port::instance()->wakeup(chan); synch_port::instance()->wakeup(chan);
......
...@@ -10,6 +10,8 @@ int msleep(void *chan, struct mtx *mtx, int priority, const char *wmesg, ...@@ -10,6 +10,8 @@ int msleep(void *chan, struct mtx *mtx, int priority, const char *wmesg,
int tsleep(void *chan, int priority, const char *wmesg, int timo); int tsleep(void *chan, int priority, const char *wmesg, int timo);
void bsd_pause(const char *wmesg, int timo);
void wakeup(void* chan); void wakeup(void* chan);
void wakeup_one(void* chan); void wakeup_one(void* chan);
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#define PAGEOFFSET (PAGESIZE - 1) #define PAGEOFFSET (PAGESIZE - 1)
#define PAGEMASK (~PAGEOFFSET) #define PAGEMASK (~PAGEOFFSET)
#define delay(x) do { } while (0) // need to do something #define delay(x) bsd_pause("soldelay", (x))
#endif /* _KERNEL */ #endif /* _KERNEL */
......
...@@ -42,6 +42,6 @@ int main(int argc, char **argv) ...@@ -42,6 +42,6 @@ int main(int argc, char **argv)
* Sleep a bit to wait for the thread to terminate. Unfortunately the * Sleep a bit to wait for the thread to terminate. Unfortunately the
* BSD kthread interface has no nice way to wait for thread termination. * BSD kthread interface has no nice way to wait for thread termination.
*/ */
tsleep(&error, 0, "kthread_test", 200); bsd_pause("kthread_test", 200);
return 0; return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment