Files
kolibrios/programs/develop/ktcc/lib/libshell/shell_ping.c
T
Egor00f 76294451d2
Build system / Build (en_US) (push) Successful in 3m18s
Build system / Build (es_ES) (push) Successful in 3m21s
Build system / Build (ru_RU) (push) Successful in 2m28s
Build system / Publish Images (push) Successful in 2m39s
libc.obj: implement console output via SHELL (#354)
Adding console I/O via the `SHELL`.

Demonstration of [http_tcp_demo.c](https://git.kolibrios.org/KolibriOS/kolibrios/src/branch/main/programs/develop/ktcc/libc.obj/samples/http_tcp_demo.c):
<video src="attachments/847d7d19-3d67-480d-80c8-6d678af61a43" title="Запись экрана от 2026-03-07 13-55-50.mp4" controls></video>

- [x] output
- [x] multithread
  - [x] add mutex
  - [x] multithread tests

Reviewed-on: #354
Reviewed-by: Mikhail Frolov <mixa.frolov2003@gmail.com>
Reviewed-by: Kiril Lipatov <lipatov.kiril@gmail.com>
Co-authored-by: Egor00f <y.yarin@inbox.ru>
2026-08-04 07:10:36 +00:00

27 lines
491 B
C

#include <shell_api.h>
#include <sys/ksys.h>
#include <sys/ksys.h>
#define SHELL_PING_TIMEOUT 10 // 0.1 sec
#define SHELL_PING_MIN_DELAY 1
int shell_ping()
{
*__shell_shm = SHELL_PING;
_ksys_thread_yield(); // hope shell is fast enough
size_t i = 0;
while (*__shell_shm != SHELL_OK)
{
if (i > (SHELL_PING_TIMEOUT / SHELL_PING_MIN_DELAY))
{
return 0;
}
i++;
_ksys_delay(SHELL_PING_MIN_DELAY);
}
return 1;
}