gap-packages / io

GAP package IO to do input and output
https://gap-packages.github.io/io/
Other
14 stars 14 forks source link

IO does not work in threads other than 0 #29

Closed sebasguts closed 6 years ago

sebasguts commented 9 years ago

IO does not work in any other thread than thread 0. To see this, type

!shell
IO_FindExecutable( "bash" );
ssiccha commented 7 years ago

Probably a bit late, but you can fix it by calling MakeImmutable( IO ); from the main thread.

Apparently the IO_* functions try to access constants(?) defined in the record IO, which is owned by thread 0.

The documentation states that:

In the C library a lot of integers are defined as macros in header files. All the necessary values for the above functions are bound to their name in the global IO record.

Is there an easy way to check, whether IO_* functions only ever read components of that record, but never write to it?

markuspf commented 7 years ago

IO has other problems with HPC-GAP in that it uses(ed?) global variables in the C code and leaks(ed?) even file descriptors.

Should be fixed really.

ssiccha commented 7 years ago

Ooh, that sounds unpleasant.

I'm trying to use it in an extra thread (i.e. not thread 0) to communicate with another non-GAP process. The first, very simple tests are running fine atm.

markuspf commented 7 years ago

What is that other non-gap process?

ssiccha commented 7 years ago

Basically a compiler I'd say. It's simulating things and we're just planning to send small messages, representing tuples, from the compiler to GAP and vice versa.

markuspf commented 7 years ago

You could use ZeroMQ for that which is thread safe and everything.

ssiccha commented 7 years ago

Ah cool, thx for the hint. I'll have a look into the HPCGAP doc. (I've looked into IO since I wanted to get named pipes to work under GAP)

fingolfin commented 6 years ago

Resolved by PR #65 resp. 2511739678a81762bab7abfe214ca8fd7a50c5a1