Experimental

Experimental — 実験的なAPI

Functions

説明

将来、このAPIは変更されるかもしれません。

Functions

cut_fork

#define             cut_fork()

子プロセスを生成します。

例:

1
2
3
4
5
6
7
8
9
10
int pid;
pid = cut_fork();
cut_assert_errno();

if (pid == 0) {
  do_something_for_child_process();
  _exit(EXIT_SUCCESS);
}

do_something_for_parent_process();

Returns

プロセスID。

Since: 0.8


cut_wait_process()

#define             cut_wait_process(pid, usec_timeout)

pidで指定されたプロセスの終了を待ちます。

例:

1
2
3
4
5
6
7
8
9
10
11
int pid;
pid = cut_fork();
cut_assert_errno();

if (pid == 0) {
  do_something_for_child_process();
  _exit(EXIT_SUCCESS);
}

do_something_for_parent_process();
cut_assert_equal_int(EXIT_SUCCESS, cut_wait_process(pid, 100));

Parameters

pid

終了を待つプロセスのID。

 

タイムアウト。

タイムアウトする時間。100万分の1秒単位で指定。

 

Since: 0.8


cut_fork_get_stdout_message()

#define             cut_fork_get_stdout_message(pid)

pidで指定されたプロセスからメッセージを読みます。

例:

1
2
3
4
5
6
7
8
9
10
11
int pid;
pid = cut_fork();
cut_assert_errno();

if (pid == 0) {
  g_print("I'm a child.");
  _exit(EXIT_SUCCESS);
}

cut_assert_equal_string("I'm a child.", cut_fork_get_stdout_message(pid));
cut_assert_equal_int(EXIT_SUCCESS, cut_wait_process(pid, 100));

Parameters

pid

プロセスID。

 

Returns

pidで指定されたプロセスの標準出力から読み込まれたメッセージ。

Since: 0.8


cut_fork_get_stderr_message()

#define             cut_fork_get_stderr_message(pid)

pidで指定されたプロセスからメッセージを読みます。

例:

1
2
3
4
5
6
7
8
9
10
11
int pid;
pid = cut_fork();
cut_assert_errno();

if (pid == 0) {
  g_print("I'm a child.");
  _exit(EXIT_SUCCESS);
}

cut_assert_equal_string("I'm a child.", cut_fork_get_stderr_message(pid));
cut_assert_equal_int(EXIT_SUCCESS, cut_wait_process(pid, 100));

Parameters

pid

プロセスID。

 

Returns

pidで指定されたプロセスの標準エラー出力から読み込まれたメッセージ。

Since: 0.8