From: Marco Costalba Date: Sat, 17 Mar 2007 07:04:58 GMT Subject: Re: Libification project (SoC) Message-ID: In-Reply-To: On 3/17/07, Johannes Schindelin wrote: > > We are talking about libgit. Which should make access to certain common > functions on Git repositories easy. Nothing more than that. > Fair enough. > If you need to do that asynchronously, do _not_ fiddle with libgit. Just > imagine what this would involve: you'd have to have timeouts (since there > is _NO_ other way to find out when to return with empty hands, instead of > blocking), which is _not_ portable. You'd soon be in the same _mess_ we > are talking about with respect to exceptions. > > Also, you would make _all_ operations expensive, since they _would_ have > to store state to be restartable. > > The common solution for your problem _is_ to use threads. > I would say, the common solution to have non blocking libgit is to use threads in the tool linked with libgit. This is clearly a design choice and I agree it's an important statement to keep libgit simple and portable (otherwise you'd probably need to use a thread library as pthread in libgit). Thread facility in Qt is instead already portable and well integrated. Anyway it's a design choice perhaps worth documenting. > And you have to admit that _only_ viewers would need asynchronous access > anyway. I doubt that other tools -- which could take their advantage of a > libgit -- would need such an access. > Yes, and you have to admit ;-) that viewers are the tools that mostly will use libgit. Marco