|
| 1 | +// Copyright 2009-2025 NTESS. Under the terms |
| 2 | +// of Contract DE-NA0003525 with NTESS, the U.S. |
| 3 | +// Government retains certain rights in this software. |
| 4 | +// |
| 5 | +// Copyright (c) 2009-2025, NTESS |
| 6 | +// All rights reserved. |
| 7 | +// |
| 8 | +// Portions are copyright of other developers: |
| 9 | +// See the file CONTRIBUTORS.TXT in the top level directory |
| 10 | +// of the distribution for more information. |
| 11 | +// |
| 12 | +// This file is part of the SST software package. For license |
| 13 | +// information, see the LICENSE file in the top level directory of the |
| 14 | +// distribution. |
| 15 | + |
| 16 | +//#include <mercury/common/skeleton.h> |
| 17 | +#include <mercury/common/timestamp.h> |
| 18 | +#include <mercury/operating_system/libraries/unblock_event.h> |
| 19 | +#include <mercury/components/operating_system_api.h> |
| 20 | +#include <mercury/components/operating_system_impl.h> |
| 21 | + |
| 22 | +namespace SST::Hg { |
| 23 | + |
| 24 | +unsigned int |
| 25 | +ssthg_sleep(unsigned int secs) { |
| 26 | + OperatingSystemAPI* cos = OperatingSystemImpl::currentOs(); |
| 27 | + Thread* t = cos->activeThread(); |
| 28 | + UnblockEvent* ev = new UnblockEvent(cos, t); |
| 29 | + cos->sendDelayedExecutionEvent(TimeDelta(secs, TimeDelta::one_second), ev); |
| 30 | + cos->block(); |
| 31 | + return 0; |
| 32 | +} |
| 33 | + |
| 34 | +unsigned int |
| 35 | +ssthg_usleep(unsigned int usecs) { |
| 36 | + OperatingSystemAPI* cos = OperatingSystemImpl::currentOs(); |
| 37 | + Thread* t = cos->activeThread(); |
| 38 | + UnblockEvent* ev = new UnblockEvent(cos, t); |
| 39 | + cos->sendDelayedExecutionEvent(TimeDelta(usecs, TimeDelta::one_microsecond), ev); |
| 40 | + cos->block(); |
| 41 | + return 0; |
| 42 | +} |
| 43 | + |
| 44 | +unsigned int |
| 45 | +ssthg_nanosleep(unsigned int nsecs) { |
| 46 | + OperatingSystemAPI* cos = OperatingSystemImpl::currentOs(); |
| 47 | + Thread* t = cos->activeThread(); |
| 48 | + UnblockEvent* ev = new UnblockEvent(cos, t); |
| 49 | + cos->sendDelayedExecutionEvent(TimeDelta(nsecs, TimeDelta::one_nanosecond), ev); |
| 50 | + cos->block(); |
| 51 | + return 0; |
| 52 | +} |
| 53 | + |
| 54 | +} //end namespace SST::Hg |
| 55 | + |
0 commit comments