compiling code on background / in parallel

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

compiling code on background / in parallel

Peter Uhnak
Hi,

can anyone think of some inherent danger to performing code compilation on background?

E.g.

[
cls := Object subclass: #Something.
cls addInstVarNamed: #myVar.
cls addInstVarNamed: #myVar2.
cls addInstVarNamed: #myVar3.
cls compile: 'method'.
cls compile: 'myVar
^ myVar'.
cls compile: 'myVar3
^ myVar3'.
cls removeInstVarNamed: #myVar3.
] fork.

Parallel operations on the same class are not an issue for me, but I don't know if this can lead to some eventual corruption (because Pharo assumes that e.g. changes file is locked etc.).

Or e.g. installing new project/package on the background while I countinue doing my work (=writing code).

Thanks,
Peter

Reply | Threaded
Open this post in threaded view
|

Re: compiling code on background / in parallel

stepharo
If you code something else in parallel you may have problem with the
source sanity.

I do not think that this element is thread safe and it would be I think
that it would block one

of the possible several threads that would be wanting to get compiled.


Stef


Le 2/10/16 à 14:15, Peter Uhnak a écrit :

> Hi,
>
> can anyone think of some inherent danger to performing code compilation on background?
>
> E.g.
>
> [
> cls := Object subclass: #Something.
> cls addInstVarNamed: #myVar.
> cls addInstVarNamed: #myVar2.
> cls addInstVarNamed: #myVar3.
> cls compile: 'method'.
> cls compile: 'myVar
> ^ myVar'.
> cls compile: 'myVar3
> ^ myVar3'.
> cls removeInstVarNamed: #myVar3.
> ] fork.
>
> Parallel operations on the same class are not an issue for me, but I don't know if this can lead to some eventual corruption (because Pharo assumes that e.g. changes file is locked etc.).
>
> Or e.g. installing new project/package on the background while I countinue doing my work (=writing code).
>
> Thanks,
> Peter
>
>