Re: [Freeciv-Dev] Threads

2013-03-25 Thread Marko Lindqvist
On 23 March 2013 22:48, Jacob Nevins
0jacobnk.fc...@chiark.greenend.org.uk wrote:
  beyond basic re-entrancy.

 That's something already. In fact, some volunteer out there could
check the system calls in utility/ with this in mind. Information
alone about any problematic system calls would be useful, but more
advanced volunteer could also provide patch series to fix the problems
found (using re-entrant versions / adding mutex protection / makign
re-entrant wrappers)


- ML

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] Threads

2013-03-23 Thread Jacob Nevins
I haven't really been closely following the introduction of threads and
concurrency into Freeciv, although I've been dimly aware that it's
happening.

However, it seems likely that there are some basics that I (and every
other developer) ought to know, such as functions and data structures in
common code that need to be kept thread-safe.

Any clues? Does doc/HACKING need an update for this?

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] Threads

2013-03-23 Thread Marko Lindqvist
On 23 March 2013 21:02, Jacob Nevins
0jacobnk.fc...@chiark.greenend.org.uk wrote:
 I haven't really been closely following the introduction of threads and
 concurrency into Freeciv, although I've been dimly aware that it's
 happening.

 Slowly, but unreliably.

 However, it seems likely that there are some basics that I (and every
 other developer) ought to know, such as functions and data structures in
 common code that need to be kept thread-safe.

 That's quite a moving target. At the moment almost nothing in game
logic is thread safe. The only shared resource between metaserver
thread and other threads is logging, which is protected by mutex. The
little functionality that threaded AI currently has in separete thread
is quite a hack at the moment, relying on the fact that map
information is never deleted mid-game (it may change unexpectedly
throwing AI a bit off, but that should be rare and not very serious
problem)

 Any clues? Does doc/HACKING need an update for this?

 Or CodingStyle? To mention that one should at least strive for thread-safety.


 - ML

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] Threads

2013-03-23 Thread Jacob Nevins
Marko Lindqvist writes:
  That's quite a moving target. At the moment almost nothing in game
 logic is thread safe. The only shared resource between metaserver
 thread and other threads is logging, which is protected by mutex. The
 little functionality that threaded AI currently has in separete thread
 is quite a hack at the moment, relying on the fact that map
 information is never deleted mid-game (it may change unexpectedly
 throwing AI a bit off, but that should be rare and not very serious
 problem)

Ah right. Sounds a bit early to worry about yet.

  Or CodingStyle? To mention that one should at least strive for thread-safety.

It does already contain such an exhortation (almost in those words), but
without more specifics I'm slightly at a loss as to how to put it into
practice, beyond basic re-entrancy.

| - Strive to make your code re-entrant (thread/recursion safe), as long as
|   this does not make the implementation too cumbersome or involved.

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev