Preemption a haskell thread inside a Transaction

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Preemption a haskell thread inside a Transaction

GHC - devs mailing list
Hi
I am trying to modify the GHC rts so that every time a transaction fails to commit, instead of automatically restart it,
I want to preempted and add it to the end of the task queue of its HEC.

The problem is, when I try to call  yield at the point of the  ATOMICALLY_FRAME code where the transaction is restarted,
I get this error message:

>>Main: Control.Concurrent.STM.atomically was nested
>>Main: thread blocked indefinitely in an MVar operation

The point in the code of PrimOps.cmm I try to put my code is as below.

PrimOps.cmm
1074   /* Transaction was not valid: try again */
1075        ("ptr" trec) = ccall stmStartTransaction(MyCapability() "ptr",
1076                                                 NO_TREC "ptr");
1077        StgTSO_trec(CurrentTSO) = trec;
1078
1079 /* call yield function here */
            Capability_context_switch(MyCapability()) = 1 :: CInt;
            jump stg_yield_noregs();
            /*                          */
1080        jump stg_ap_v_fast
1081            // push the StgAtomicallyFrame again: the code generator is
1082            // clever enough to only assign the fields that have changed.
1083            (ATOMICALLY_FRAME_FIELDS(,,info_ptr,p1,p2,
1084                                     code,frame_result))
1085            (code);


My doubts are:
    Is it possible to make a preemption at that point in the ATOMICALLY_FRAME code?. If it is possible, how do I proceed?
   
Thanks for the attention.
Best regards.

--
Rodrigo M. Duarte
Bacharelado em Engenharia de Computação
LUPS - Laboratory of Ubiquitous and Parallel Systems
Computação de Alto Desempenho Sustentável
Universidade Federal de Pelotas - UFPel

image_png_part?hl=pt&part=2&thumb=1

Antes de imprimir este e-mail pense em sua responsabilidade e compromisso com o Meio Ambiente. Só imprima se for realmente necessário. 


Before printing this e-mail consider its responsibility and commitment to the environment. Only print if it is really necessary. 


_______________________________________________
ghc-devs mailing list
[hidden email]
http://mail.haskell.org/cgi-bin/mailman/listinfo/ghc-devs