Threads
Tim
tim.moldazhan at gmail.com
Wed Mar 22 08:31:29 UTC 2023
On Wednesday, 22 March 2023 at 07:16:43 UTC, Kagamin wrote:
> static is thread local by default.
>
> ```
> module main;
> import app;
> import core.thread;
>
> int main(string[] args)
> {
> static shared int result;
> static shared string[] args_copy;
>
> static void app_thread()
> {
> App app = new App();
> result = app.run(args_copy); // <-- Stucked here!
> }
>
> args_copy = cast(shared)args;
>
> // Running app interface in a thread;
> Thread thread = new Thread(&app_thread).start();
> thread.join();
>
> return result;
> }
> ```
I've changed "int App.run(string[] args)" to "int App.run(shared
string[] args)" in app module. Now I've got an error in
std.getopt.getopt in the same module.
Error: none of the overloads of template `std.getopt.getopt` are
callable using argument types `!()(shared(string[]), string,
string, string*)`
Am I doing something wrong?
More information about the Digitalmars-d-learn
mailing list