summaryrefslogtreecommitdiffhomepage
path: root/Kernel/Sources
diff options
context:
space:
mode:
Diffstat (limited to 'Kernel/Sources')
-rw-r--r--Kernel/Sources/KernelHeap.cxx1
-rw-r--r--Kernel/Sources/ProcessScheduler.cxx13
-rw-r--r--Kernel/Sources/Semaphore.cxx19
3 files changed, 25 insertions, 8 deletions
diff --git a/Kernel/Sources/KernelHeap.cxx b/Kernel/Sources/KernelHeap.cxx
index c3e8e86b..875e00fb 100644
--- a/Kernel/Sources/KernelHeap.cxx
+++ b/Kernel/Sources/KernelHeap.cxx
@@ -185,6 +185,7 @@ namespace NewOS
{
virtualAddress->fCRC32 =
ke_calculate_crc32((Char*)virtualAddress->fTargetPtr, virtualAddress->fTargetPtrSize);
+
return true;
}
}
diff --git a/Kernel/Sources/ProcessScheduler.cxx b/Kernel/Sources/ProcessScheduler.cxx
index 315dc07a..ca9a3435 100644
--- a/Kernel/Sources/ProcessScheduler.cxx
+++ b/Kernel/Sources/ProcessScheduler.cxx
@@ -27,13 +27,19 @@ namespace NewOS
/// @brief Exit Code global
/***********************************************************************************/
- STATIC Int32 kLastExitCode = 0U;
+ STATIC Int32 cLastExitCode = 0U;
/// @brief Gets the latest exit code.
/// @note Not thread-safe.
+ /// @return Int32 the last exit code.
+ const Int32& ProcessHeader::GetExitCode() noexcept
+ {
+ return fLastExitCode;
+ }
+
const Int32& rt_get_exit_code() noexcept
{
- return kLastExitCode;
+ return cLastExitCode;
}
/***********************************************************************************/
@@ -164,7 +170,8 @@ namespace NewOS
ProcessScheduler::The().Leak().TheCurrent().Leak().ProcessId)
ke_stop(RUNTIME_CHECK_PROCESS);
- kLastExitCode = exit_code;
+ fLastExitCode = exit_code;
+ cLastExitCode = exit_code;
//! Delete image if not done already.
if (this->Image)
diff --git a/Kernel/Sources/Semaphore.cxx b/Kernel/Sources/Semaphore.cxx
index d52cf447..45fccbca 100644
--- a/Kernel/Sources/Semaphore.cxx
+++ b/Kernel/Sources/Semaphore.cxx
@@ -6,7 +6,6 @@
#include <KernelKit/ProcessScheduler.hxx>
#include <KernelKit/Semaphore.hpp>
-#include <KernelKit/Timer.hpp>
namespace NewOS
{
@@ -33,21 +32,31 @@ namespace NewOS
return fLockingProcess;
}
- bool Semaphore::LockOrWait(ProcessHeader* process, const Int64& seconds)
+ bool Semaphore::LockOrWait(ProcessHeader* process, HardwareTimerInterface* timer)
{
if (process == nullptr)
return false;
- HardwareTimer timer(Seconds(seconds));
- timer.Wait();
+ if (timer == nullptr)
+ return false;
+
+ this->Lock(process);
+
+ timer->Wait();
return this->Lock(process);
}
- void Semaphore::Sync() noexcept
+ /// @brief Wait with process, either wait for process being invalid, or not being run.
+ Void Semaphore::WaitForProcess() noexcept
{
while (fLockingProcess)
{
+ if (fLockingProcess->GetStatus() != ProcessStatus::kRunning)
+ {
+ this->Unlock();
+ break;
+ }
}
}
} // namespace NewOS