Skip to content

Commit a467d31

Browse files
committed
FIX: include TASK! evaluation only with INCLUDE_TASK define
... because TASK! is not implemented yet and causes crashes. related to: Oldes/Rebol-issues#47
1 parent 8657b02 commit a467d31

File tree

4 files changed

+28
-1
lines changed

4 files changed

+28
-1
lines changed

make/make-settings.r

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ Defines: [
1717
USE_LZMA ;-- adds support for LZMA [de]compression
1818
USE_MIDI_DEVICE ;-- includes MIDI device when possible (Windows & macOS)
1919

20+
;INCLUDE_TASK ;-- tasks are not implemented yet, so include it only on demand
21+
2022
;@@ optional fine tuning:
2123
;DO_NOT_NORMALIZE_MAP_KEYS
2224
; with above define you would get:

src/core/c-task.c

+7-1
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959

6060
#include "sys-core.h"
6161

62+
#ifdef INCLUDE_TASK
6263
/***********************************************************************
6364
**
6465
*/ static void Launch_Task(REBVAL *task)
@@ -76,13 +77,18 @@
7677

7778
Debug_Str("End Task");
7879
}
79-
80+
#endif
8081

8182
/***********************************************************************
8283
**
8384
*/ void Do_Task(REBVAL *task)
8485
/*
8586
***********************************************************************/
8687
{
88+
#ifdef INCLUDE_TASK
8789
OS_CREATE_THREAD((void*)Launch_Task, task, 50000);
90+
#else
91+
puts("** Build using INCLUDE_TASK define to experiment with task!");
92+
Trap0(RE_FEATURE_NA);
93+
#endif
8894
}

src/tests/run-tests.r3

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ dt [ ;- delta time
4646
wrap load %units/typeset-test.r3
4747
wrap load %units/datatype-test.r3
4848
wrap load %units/parse-test.r3
49+
wrap load %units/task-test.r3
4950

5051
recycle/torture
5152
recycle

src/tests/units/task-test.r3

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Rebol [
2+
Title: "Rebol3 task test script"
3+
Author: "Oldes, Peter W A Wood"
4+
File: %task-test.r3
5+
Tabs: 4
6+
Needs: [%../quick-test-module.r3]
7+
]
8+
9+
~~~start-file~~~ "TASK!"
10+
11+
===start-group=== "task"
12+
--test-- "issues-47"
13+
;@@ https://github.com/Oldes/Rebol-issues/issues/47
14+
--assert error? try [do make task! [2 / 0]] ; trying to evaluate a task should not crash!
15+
16+
===end-group===
17+
18+
~~~end-file~~~

0 commit comments

Comments
 (0)