Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-13 Thread Alexander Grau
Am 12.07.2010 um 22:58 schrieb Jonas Maebe: Alexander Grau wrote on Mon, 12 Jul 2010: Am 12.07.2010 um 22:31 schrieb Jonas Maebe: I forgot to mention: before this works, you have to create at least one thread using the FPC RTL in order to initialise the threading subsystem. It can be

[fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Alexander Grau
Hello, While using an external C framework (Mac OS X, discrecording OS framework, FPC 2.4), I noticed that my FPC console app crashes when I use writeln's in both C threads (callbacks). Example: Two FPC functions that are called from an external C library (c_callback1 and c_callback2) -

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Michael Van Canneyt
Basically, any heap memory access and standard pascal I/O are forbidden in threads started outside FPC, because the necessary thread structures are not initialized correctly. Michael. On Mon, 12 Jul 2010, Alexander Grau wrote: Hello, While using an external C framework (Mac OS X,

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Alexander Grau
Am 12.07.2010 um 13:24 schrieb Michael Van Canneyt: Basically, any heap memory access and standard pascal I/O are forbidden in threads started outside FPC, because the necessary thread structures are not initialized correctly. Is my assumption correct that this means I cannot use much

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Michael Van Canneyt
On Mon, 12 Jul 2010, Alexander Grau wrote: Am 12.07.2010 um 13:24 schrieb Michael Van Canneyt: Basically, any heap memory access and standard pascal I/O are forbidden in threads started outside FPC, because the necessary thread structures are not initialized correctly. Is my

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Jonas Maebe
On 12 Jul 2010, at 13:24, Michael Van Canneyt wrote: Basically, any heap memory access and standard pascal I/O are forbidden in threads started outside FPC, because the necessary thread structures are not initialized correctly. I think that I've finally found a way to resolve this properly

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Alexander Grau
Am 12.07.2010 um 18:17 schrieb Jonas Maebe: On 12 Jul 2010, at 13:24, Michael Van Canneyt wrote: Basically, any heap memory access and standard pascal I/O are forbidden in threads started outside FPC, because the necessary thread structures are not initialized correctly. I think that

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Alexander Grau
Am 12.07.2010 um 18:17 schrieb Jonas Maebe: On 12 Jul 2010, at 13:24, Michael Van Canneyt wrote: Basically, any heap memory access and standard pascal I/O are forbidden in threads started outside FPC, because the necessary thread structures are not initialized correctly. I think that

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Michael Van Canneyt
On Mon, 12 Jul 2010, Alexander Grau wrote: Am 12.07.2010 um 18:17 schrieb Jonas Maebe: On 12 Jul 2010, at 13:24, Michael Van Canneyt wrote: Basically, any heap memory access and standard pascal I/O are forbidden in threads started outside FPC, because the necessary thread structures are

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Jonas Maebe
Alexander Grau wrote on Mon, 12 Jul 2010: Am 12.07.2010 um 18:17 schrieb Jonas Maebe: On 12 Jul 2010, at 13:24, Michael Van Canneyt wrote: Basically, any heap memory access and standard pascal I/O are forbidden in threads started outside FPC, because the necessary thread structures are

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Jonas Maebe
Michael Van Canneyt wrote on Mon, 12 Jul 2010: On Mon, 12 Jul 2010, Alexander Grau wrote: r15557 | jonas | 2010-07-12 18:16:50 +0200 (Mo, 12 Jul 2010) | 3 lines + added support for intialising/finalising threads not started via the FPC runtime I don't see how this helps, because

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Alexander Grau
Am 12.07.2010 um 22:31 schrieb Jonas Maebe: Alexander Grau wrote on Mon, 12 Jul 2010: Am 12.07.2010 um 18:17 schrieb Jonas Maebe: On 12 Jul 2010, at 13:24, Michael Van Canneyt wrote: Basically, any heap memory access and standard pascal I/O are forbidden in threads started outside FPC,

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Jonas Maebe
Alexander Grau wrote on Mon, 12 Jul 2010: Am 12.07.2010 um 22:31 schrieb Jonas Maebe: I forgot to mention: before this works, you have to create at least one thread using the FPC RTL in order to initialise the threading subsystem. It can be terminated/freed immediately, see the test

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Michael Van Canneyt
On Mon, 12 Jul 2010, Jonas Maebe wrote: Alexander Grau wrote on Mon, 12 Jul 2010: Am 12.07.2010 um 22:31 schrieb Jonas Maebe: I forgot to mention: before this works, you have to create at least one thread using the FPC RTL in order to initialise the threading subsystem. It can be

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Jonas Maebe
Michael Van Canneyt wrote on Mon, 12 Jul 2010: On Mon, 12 Jul 2010, Jonas Maebe wrote: One small detail : maybe we should create a call 'inittheading' or make the 'IsMultithreaded' variable a property, that, when written, does the initialization ? That's a bit cleaner than creating a thread ?

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Michael Van Canneyt
On Mon, 12 Jul 2010, Jonas Maebe wrote: Michael Van Canneyt wrote on Mon, 12 Jul 2010: On Mon, 12 Jul 2010, Jonas Maebe wrote: One small detail : maybe we should create a call 'inittheading' or make the 'IsMultithreaded' variable a property, that, when written, does the initialization ?

Re: [fpc-pascal] writeln: FPC runtime race conditions in external C threads

2010-07-12 Thread Jonas Maebe
Michael Van Canneyt wrote on Mon, 12 Jul 2010: On Mon, 12 Jul 2010, Jonas Maebe wrote: Michael Van Canneyt wrote on Mon, 12 Jul 2010: One small detail : maybe we should create a call 'inittheading' or make the 'IsMultithreaded' variable a property, that, when written, does the