After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 734010 - Unbreak repository tests on OpenBSD (rework blob state machine)
Unbreak repository tests on OpenBSD (rework blob state machine)
Status: RESOLVED FIXED
Product: libgit2-glib
Classification: Core
Component: General
git master
Other OpenBSD
: Normal normal
: ---
Assigned To: gitg-maint
gitg-maint
Depends on:
Blocks:
 
 
Reported: 2014-07-30 22:06 UTC by Jasper Lievisse Adriaanse
Modified: 2019-02-22 03:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Rework synchronization around a state machine (6.70 KB, patch)
2014-07-30 22:06 UTC, Jasper Lievisse Adriaanse
none Details | Review
Rework synchronization around a state machine (6.40 KB, patch)
2014-07-30 22:12 UTC, Jasper Lievisse Adriaanse
committed Details | Review

Description Jasper Lievisse Adriaanse 2014-07-30 22:06:41 UTC
Created attachment 282111 [details] [review]
Rework synchronization around a state machine

The 'repository' tests were failing on OpenBSD with a SIGABRT which led us to investigate the issue which seemed related to the strict mutex type on OpenBSD (unlocking an already locked mutex is forbidden). However, our "main threads developer" noticed several issues with the code surrounding it:

"Rework synchronization around a state machine instead of trying to treat                                                                                                                                                          
mutexes and condition variables like semaphores.  Should reduce the                                                                                                                                                               
low-level locking operations and eliminates the attempt to lock a mutex in                                                                                                                                                        
one thread but unlock it another that violates POSIX requirements."

The attached patch fixes the issues described. OK to push?
Comment 1 Jasper Lievisse Adriaanse 2014-07-30 22:12:30 UTC
Created attachment 282113 [details] [review]
Rework synchronization around a state machine

Slightly tweak patch to undo function blob_chunk_cb() signature change.
Comment 2 Ignacio Casal Quinteiro (nacho) 2014-07-31 06:30:02 UTC
Review of attachment 282113 [details] [review]:

This is probably better to be reviewed by jesse, in the meantime please see the minor style comment I added.

::: libgit2-glib/ggit-blob-output-stream.c
@@ +51,3 @@
+	 * CLOSED -> closed by outside thread or error, exit and set result
+	 */
+	enum { IDLE, SENDING, CANCELLED, CLOSED } state;

please put the enum out of the struct with a typedef
Comment 3 jessevdk@gmail.com 2014-12-17 18:51:52 UTC
Great work, definitely simpler/better! Sorry that it took some time to actually push it. I've made the small changes suggested by nacho as well as minor code style.