call "CBL_THREAD_CREATE_P" using by value entry-point by reference thread-param by value param-size by value flags by value priority by value stack-size by reference thread-id
Using call prototype (see Key) | Picture | |
---|---|---|
entry-point | cblt-ppointer | usage procedure-pointer. |
thread-param | pic x(n) null or space terminated | Any data item. |
param-size | cblt-os-size | pic x(4) comp-5
or pic x(8) comp-5 (64-bit native programs only) |
flags | cblt-os-flags | pic x(4) comp-5
or pic x(8) comp-5 (64-bit native programs only) |
priority | cblt-sx4-comp5 | pic s9(9) comp-5 |
stack-size | cblt-os-size | pic x(4) comp-5
or pic x(8) comp-5 (64-bit native programs only) |
thread-id | cblt-pointer | usage pointer. |
0 | Only the address of thread-param is passed as the parameter to the entry point in the new thread without any copying of data values |
>0 | The value of thread-param is copied for a length of param-size and the address of this copy area is passed to the new thread. The value of thread-param will still be intact for the created thread, even if the creating thread changes or deallocates thread-param immediately after the CBL_THREAD_CREATE call. |
0 | Detach thread immediately when the thread terminates. |
1 | Do not detach thread immediately. Even when the thread has terminated, its resources are not freed until thread is detached. |
0 | Thread priority is absolute (0 to 100). |
1 | Thread priority is relative (-100 to +100). |
0 | Any monitors or mutexes locked by this thread when the thread terminates can cause a run-time system error. |
1 | An error will not be issued if monitors or mutexes are locked when the thread terminates |
0 | Create active |
1 | Create suspended
Restriction: This is deprecated in the
.NET environment
|
0 | Multi-threaded Apartment model (MTA) |
1 | Single threaded Apartment model (STA) |
Comments:
The entry point specified can be implemented in any language.
If the call succeeds and a new thread is created, its thread identifier is stored in thread-id and the RETURN-CODE is set to 0. This is true even if the thread is created detached, however in this case the caller should take care to ensure that the new thread still exists before using the thread-id in any other call.
If the call fails thread-id is set to NULL and an error number is set in RETURN-CODE.
In certain circumstances, it may not be possible to specify stack-size for .NET COBOL programs; refer to https://docs.microsoft.com/en-us/dotnet/api/system.threading.thread.-ctor?view=net-6.0#system-threading-thread-ctor(system-threading-threadstart-system-int32) for more information.