Skip to content

task_detach crash with JIT #54

Open
@badabingbadabooom

Description

@badabingbadabooom

Using the task_detach function and later using any asynchronous function crashes the server if the script is JIT compiled.

Running this script in Windows and with jit_sleep enabled, the server crashes after "detached" gets printed on the console.

#include <PawnPlus>
#include <a_samp>
#include <jit>

public OnJITCompile()
{
	return 1;
}

myfunc(time)
{
	printf("myfunc(time = %i)", time);

	print("detaching...");
	task_detach();
	task_yield(1);
	print("detached");
	
	wait_ms(time);
	
	printf("%i milliseconds have passed", time);
	
	return 1;
}

main()
{
	new r = myfunc(1000);
	printf("myfunc returned %i", r); 
	return 0; 
}

With no JIT, it gives the expected output:

myfunc(time = 1000)
detaching...
detached
myfunc returned 1
Number of vehicle models: 0
1000 milliseconds have passed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions